Skip to content

Commit 9e6790f

Browse files
Prevent a crash by exiting here (#4449)
* Prevent a crash by exiting here And make an assertion more explicit, just in case. * Fix comment
1 parent 993a9e9 commit 9e6790f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

code/hud/hudreticle.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,21 @@ ship_info *sip = &Ship_info[Player_ship->ship_info_index];
309309
}
310310

311311
void HudGaugeReticle::getFirepointStatus() {
312+
313+
// allow the firepoint status to be empty when a multiplayer observer
314+
// this is not a bug, the observer will simply *not* have any firepoints.
315+
if (Objects[Player->objnum].type == OBJ_OBSERVER) {
316+
// only multiplayer instances should be getting here!
317+
Assertion((Game_mode & GM_MULTIPLAYER), "Somehow FSO thinks its player object is an observer even though it's not in Multiplayer. Please report!");
318+
return;
319+
}
320+
312321
//First, get the player ship
313322
ship_info* sip;
314323
ship* shipp;
315324
polymodel* pm;
316325

317-
Assert(Objects[Player->objnum].type == OBJ_SHIP);
326+
Assertion(Objects[Player->objnum].type == OBJ_SHIP, "HudGaugeReticle::getFirepointStatus was passed an invalid object type of %d. Please report!", Objects[Player->objnum].type);
318327

319328
if (Objects[Player->objnum].type == OBJ_SHIP) {
320329
shipp = &Ships[Objects[Player->objnum].instance];

0 commit comments

Comments
 (0)