summaryrefslogtreecommitdiff
path: root/src/console.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-03-24 11:20:30 +0000
committeryexo <yexo@openttd.org>2010-03-24 11:20:30 +0000
commit37a37c191defeba5506e87c64e9a31fb54442b96 (patch)
tree0fc376a82f62c83551bdb25294aabeeff2d8942a /src/console.cpp
parentf4a107dae518ddad9d41240123d62cda3b88b671 (diff)
downloadopenttd-37a37c191defeba5506e87c64e9a31fb54442b96.tar.xz
(svn r19512) -Fix (r19511): using the 'alias' console command it's possible to create a duplicate alias name
Diffstat (limited to 'src/console.cpp')
-rw-r--r--src/console.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/console.cpp b/src/console.cpp
index 222bed024..e5d5ae962 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -261,6 +261,11 @@ IConsoleCmd *IConsoleCmdGet(const char *name)
*/
void IConsoleAliasRegister(const char *name, const char *cmd)
{
+ if (IConsoleAliasGet(name) != NULL) {
+ IConsoleError("an alias with this name already exists; insertion aborted");
+ return;
+ }
+
char *new_alias = strdup(name);
char *cmd_aliased = strdup(cmd);
IConsoleAlias *item_new = MallocT<IConsoleAlias>(1);