(svn r19264) -Fix (r19179): strgen segfaults when trying to lookup the command for a non-existing command

This commit is contained in:
rubidium 2010-02-26 10:03:33 +00:00
parent 425ac1ec1f
commit eb220617d5
1 changed files with 2 additions and 2 deletions

View File

@ -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++) {