From dc1d34aa0b9eab14ed5c71cbd28a2b72851f92a7 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 43f26ac71..0aa3b9c6b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -14193,8 +14193,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;