Fix segfault when setting up view frame for a removed mobj

This commit is contained in:
Hanicef 2024-01-18 23:51:25 +01:00
parent 3176abe2e4
commit 820a70b854
2 changed files with 2 additions and 2 deletions

View file

@ -1198,7 +1198,7 @@ void R_SetupFrame(player_t *player)
newview->x += quake.x;
newview->y += quake.y;
if (r_viewmobj->subsector)
if (!P_MobjWasRemoved(r_viewmobj) && r_viewmobj->subsector)
newview->sector = r_viewmobj->subsector->sector;
else
newview->sector = R_PointInSubsector(newview->x, newview->y)->sector;

View file

@ -3495,7 +3495,7 @@ boolean R_ThingVisible (mobj_t *thing)
(thing->sprite == SPR_NULL) || // Don't draw null-sprites
(thing->flags2 & MF2_DONTDRAW) || // Don't draw MF2_LINKDRAW objects
(thing->drawonlyforplayer && thing->drawonlyforplayer != viewplayer) || // Don't draw other players' personal objects
(r_viewmobj && (
(!P_MobjWasRemoved(r_viewmobj) && (
(r_viewmobj == thing) || // Don't draw first-person players or awayviewmobj objects
(r_viewmobj->player && r_viewmobj->player->followmobj == thing) || // Don't draw first-person players' followmobj
(r_viewmobj == thing->dontdrawforviewmobj) // Don't draw objects that are hidden for the current view