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

View file

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