Fix a segfault when setting up the stack.

Yup, putting {}s around even single statements under flow control (if, etc)
is a good idea. Wonder if there's a gcc warning for that...
This commit is contained in:
Bill Currie 2018-10-11 13:34:08 +09:00
parent 6252faa069
commit 33cbc500e8
1 changed files with 4 additions and 3 deletions

View File

@ -151,10 +151,11 @@ PR_ResolveGlobals (progs_t *pr)
}
if (!pr->globals.stack) {
if ((def = PR_FindGlobal (pr, ".stack"))
|| (def = PR_FindGlobal (pr, "stack")))
|| (def = PR_FindGlobal (pr, "stack"))) {
pr->globals.stack = &G_POINTER (pr, def->ofs);
// the stack is at the very end of the progs memory map
*pr->globals.stack = pr->globals_size;
// the stack is at the very end of the progs memory map
*pr->globals.stack = pr->globals_size;
}
}
if (pr->fields.nextthink == -1)
if ((def = PR_FindField (pr, "nextthink")))