From eb220617d555925879a9e81a7911769b8f6c5a9d Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 26 Feb 2010 10:03:33 +0000 Subject: (svn r19264) -Fix (r19179): strgen segfaults when trying to lookup the command for a non-existing command --- src/strgen/strgen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/strgen') 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 ? "" : cmd->cmd); } for (nw = 0; nw < MAX_NUM_GENDER; nw++) { -- cgit v1.2.3-54-g00ecf