From e264caffe3599f37c119aeac91c3e54f16bce9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Fri, 2 Jun 2023 23:44:50 +0200 Subject: [PATCH] Fix dangling pointer in mapthing after removing mobj --- src/p_mobj.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index a81845918..5c352cd04 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11204,6 +11204,10 @@ void P_RemoveMobj(mobj_t *mobj) P_SetTarget(&mobj->hnext, P_SetTarget(&mobj->hprev, NULL)); + // clear the reference from the mapthing + if (mobj->spawnpoint) + mobj->spawnpoint->mobj = NULL; + R_RemoveMobjInterpolator(mobj); // free block