From a268bc83b79912813cd78a4fb1f6b99bcbed3ea0 Mon Sep 17 00:00:00 2001 From: Kp Date: Wed, 31 Jul 2013 22:23:51 +0000 Subject: [PATCH] Only initialize a reactor if it exists Windows users reported a crash on starting a level with no reactor. derhass traced it to an unconditional initialization of Objects[cntrlcen_objnum] members, even if cntrlcen_objnum is -1. Fix this by checking for the reactor before accessing it. --- main/cntrlcen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/cntrlcen.c b/main/cntrlcen.c index f546219b3..0a028d23d 100644 --- a/main/cntrlcen.c +++ b/main/cntrlcen.c @@ -456,7 +456,7 @@ void init_controlcen_for_level(void) Objects[cntrlcen_objnum].render_type = RT_NONE; Control_center_present = 0; } - } else { + } else if (cntrlcen_objnum != -1) { // Compute all gun positions. objp = &Objects[cntrlcen_objnum]; reactor *reactor = get_reactor_definition(objp->id);