diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-02-11 20:35:21 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-02-11 20:35:21 +1100 |
| commit | f3c19ba7fa437a2512db5261742a494769f46b56 (patch) | |
| tree | cfbd85935cd8d36157509acd4b3f2ac0cc0266e2 | |
| parent | 01259bf22cf1d8594809a3add234631ef214c954 (diff) | |
Prevent whitespaces in command names
Fixes #1843
| -rw-r--r-- | src/commands.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/commands.cc b/src/commands.cc index de7d0c98..8e58a7e6 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)); |
