diff --git a/src/commands.cc b/src/commands.cc index de7d0c98a..8e58a7e6e 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -842,6 +842,9 @@ void define_command(const ParametersParser& parser, Context& context, const Shel const String& cmd_name = parser[0]; auto& cm = CommandManager::instance(); + if (contains_that(cmd_name, is_blank)) + throw runtime_error(format("invalid command name: '{}'", cmd_name)); + if (cm.command_defined(cmd_name) and not parser.get_switch("allow-override")) throw runtime_error(format("command '{}' already defined", cmd_name));