src: Forbid empty menu entries

Empty entries in menus look weird, and don't serve any purpose. Empty
commands are still allowed.
This commit is contained in:
Frank LENORMAND 2018-08-11 10:03:55 +03:00
parent 983a8f759a
commit 97abfd403d

View File

@ -1931,6 +1931,9 @@ const CommandDesc menu_cmd = {
Vector<String> select_cmds; Vector<String> select_cmds;
for (int i = 0; i < count; i += modulo) for (int i = 0; i < count; i += modulo)
{ {
if (parser[i].empty())
throw runtime_error(format("entry #{} is empty", i+1));
choices.push_back(markup ? parse_display_line(parser[i], context.faces()) choices.push_back(markup ? parse_display_line(parser[i], context.faces())
: DisplayLine{ parser[i], {} }); : DisplayLine{ parser[i], {} });
commands.push_back(parser[i+1]); commands.push_back(parser[i+1]);