From 72c2fa645d7078a8979226b928597ed0ca22b788 Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Thu, 3 Jul 2025 02:17:45 -0400 Subject: [PATCH] Fix use-after-remove when bailing with attracting rings --- src/k_kart.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 76d9fb0f5..73268493c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -14206,8 +14206,15 @@ void K_MoveKartPlayer(player_t *player, boolean onground) // really silly stupid dumb HACK to fix interp // without needing to duplicate any code A_AttractChase(ring); - P_SetOrigin(ring, ring->x, ring->y, ring->z); - ring->extravalue1 = 1; + + // ring can be removed if the player is in a state that explicitly blocks ring pickup + // try not to go crazy for a week figuring out why bail randomly crashes :)))))) + if (ring && !P_MobjWasRemoved(ring)) + { + P_SetOrigin(ring, ring->x, ring->y, ring->z); + ring->extravalue1 = 1; + } + UINT8 dumprate = 3;