From 97abfd403d4d7a9e663d965cb670df90d6056a53 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Sat, 11 Aug 2018 10:03:55 +0300 Subject: [PATCH] src: Forbid empty `menu` entries Empty entries in menus look weird, and don't serve any purpose. Empty commands are still allowed. --- src/commands.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/commands.cc b/src/commands.cc index dcee0281..b249b476 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1931,6 +1931,9 @@ const CommandDesc menu_cmd = { Vector select_cmds; 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()) : DisplayLine{ parser[i], {} }); commands.push_back(parser[i+1]);