From d7744308f606afa85267ac0b3b9ebc611b620246 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 11 Aug 2015 13:37:38 +0100 Subject: [PATCH] Ensure the command exist before adding an alias Fixes #371 --- src/commands.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/commands.cc b/src/commands.cc index af044285..c4ed618e 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -847,6 +847,9 @@ const CommandDesc alias_cmd = { CommandCompleter{}, [](const ParametersParser& parser, Context& context) { + if (not CommandManager::instance().command_defined(parser[2])) + throw runtime_error(format("Command '{}' does not exist", parser[2])); + AliasRegistry& aliases = get_scope(parser[0], context).aliases(); aliases.add_alias(parser[1], parser[2]); }