From 33cbc500e84c646e9d42b35d080efc2d14501cdb Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 11 Oct 2018 13:34:08 +0900 Subject: [PATCH] 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... --- libs/gamecode/pr_resolve.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/gamecode/pr_resolve.c b/libs/gamecode/pr_resolve.c index c506c97ac..ba82b48e8 100644 --- a/libs/gamecode/pr_resolve.c +++ b/libs/gamecode/pr_resolve.c @@ -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")))