From 859e907396b6039b0899b3942acbbda505e0e98d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 11 Sep 2012 14:28:54 +0200 Subject: [PATCH] fix NCursesClient::menu_select for one past last item --- src/ncurses.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ncurses.cc b/src/ncurses.cc index 3f2f79903..a6590431a 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -254,7 +254,8 @@ void NCursesClient::menu_show(const memoryview& choices) void NCursesClient::menu_select(int selected) { - if (0 <= selected and selected < m_items.size()) + // last item in m_items is the nullptr, hence the - 1 + if (selected >= 0 and selected < m_items.size() - 1) { set_menu_fore(m_menu, COLOR_PAIR(m_menu_fg)); set_current_item(m_menu, m_items[selected]);