mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-19 13:41:11 +00:00
(svn r19264) -Fix (r19179): strgen segfaults when trying to lookup the command for a non-existing command
This commit is contained in:
parent
425ac1ec1f
commit
eb220617d5
@ -399,8 +399,8 @@ static void EmitGender(char *buf, int value)
|
|||||||
if (!ParseRelNum(&buf, &argidx, &offset)) {}
|
if (!ParseRelNum(&buf, &argidx, &offset)) {}
|
||||||
|
|
||||||
const CmdStruct *cmd = _cur_pcs.cmd[argidx];
|
const CmdStruct *cmd = _cur_pcs.cmd[argidx];
|
||||||
if ((cmd->flags & C_GENDER) == 0) {
|
if (cmd == NULL || (cmd->flags & C_GENDER) == 0) {
|
||||||
error("Command '%s' can't have a gender", cmd->cmd);
|
error("Command '%s' can't have a gender", cmd == NULL ? "<empty>" : cmd->cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (nw = 0; nw < MAX_NUM_GENDER; nw++) {
|
for (nw = 0; nw < MAX_NUM_GENDER; nw++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user