diff options
author | rubidium <rubidium@openttd.org> | 2010-02-26 10:03:33 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-02-26 10:03:33 +0000 |
commit | eb220617d555925879a9e81a7911769b8f6c5a9d (patch) | |
tree | e3f3ccd0de0dc424e293a7c6a96ea071a7047ba5 /src/strgen | |
parent | 425ac1ec1f5f17c75afcbaba4c2296134459f05a (diff) | |
download | openttd-eb220617d555925879a9e81a7911769b8f6c5a9d.tar.xz |
(svn r19264) -Fix (r19179): strgen segfaults when trying to lookup the command for a non-existing command
Diffstat (limited to 'src/strgen')
-rw-r--r-- | src/strgen/strgen.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index 1048ac09c..22450bddf 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -399,8 +399,8 @@ static void EmitGender(char *buf, int value) if (!ParseRelNum(&buf, &argidx, &offset)) {} const CmdStruct *cmd = _cur_pcs.cmd[argidx]; - if ((cmd->flags & C_GENDER) == 0) { - error("Command '%s' can't have a gender", cmd->cmd); + if (cmd == NULL || (cmd->flags & C_GENDER) == 0) { + error("Command '%s' can't have a gender", cmd == NULL ? "<empty>" : cmd->cmd); } for (nw = 0; nw < MAX_NUM_GENDER; nw++) { |