NCurses: handle empty items in menu_show

This commit is contained in:
Maxime Coste 2013-03-11 14:19:46 +01:00
parent ddc894ccfe
commit 17b861d78e

View File

@ -334,7 +334,7 @@ void NCursesUI::menu_show(const memoryview<String>& choices,
CharCount longest = 0; CharCount longest = 0;
for (auto& choice : choices) 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(), "")); m_items.emplace_back(new_item(m_choices.back().c_str(), ""));
longest = std::max(longest, m_choices.back().char_length()); longest = std::max(longest, m_choices.back().char_length());
} }