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.
This commit is contained in:
parent
20f8deb62a
commit
a268bc83b7
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue