From 820a70b8542d0b8d9148b57c6b6c40709de2d143 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Thu, 18 Jan 2024 23:51:25 +0100 Subject: [PATCH] Fix segfault when setting up view frame for a removed mobj --- src/r_main.c | 2 +- src/r_things.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 94116f8fd..7457fa32f 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -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; diff --git a/src/r_things.c b/src/r_things.c index 084871700..edb8f0859 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -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