From 17b861d78e0e45a1f142eb31f1037a1d35f09106 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 11 Mar 2013 14:19:46 +0100 Subject: [PATCH] NCurses: handle empty items in menu_show --- src/ncurses.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ncurses.cc b/src/ncurses.cc index 3280329a..a248405b 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -334,7 +334,7 @@ void NCursesUI::menu_show(const memoryview& choices, CharCount longest = 0; for (auto& choice : choices) { - m_choices.push_back(choice.substr(0_char, std::min((int)maxsize.column-1, 200))); + m_choices.push_back(choice.empty() ? " " : choice.substr(0_char, std::min((int)maxsize.column-1, 200))); m_items.emplace_back(new_item(m_choices.back().c_str(), "")); longest = std::max(longest, m_choices.back().char_length()); }