Mercurial > hg > openttd
changeset 14683:e04918801796 draft
(svn r19264) -Fix (r19179): strgen segfaults when trying to lookup the command for a non-existing command
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 26 Feb 2010 10:03:33 +0000 |
parents | aa3e0d8fcf57 |
children | a3a22a86ccc3 |
files | src/strgen/strgen.cpp |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -399,8 +399,8 @@ 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++) {