From 9793b56f84c527d80c1f653b2eff4f3c98875865 Mon Sep 17 00:00:00 2001 From: MysterD Date: Wed, 13 Apr 2022 01:37:07 -0700 Subject: [PATCH] Fixed crash in act_caught_in_whirlpool --- src/game/mario_actions_submerged.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/game/mario_actions_submerged.c b/src/game/mario_actions_submerged.c index 789e02944..4a1b8d397 100644 --- a/src/game/mario_actions_submerged.c +++ b/src/game/mario_actions_submerged.c @@ -1076,6 +1076,11 @@ static s32 act_caught_in_whirlpool(struct MarioState *m) { struct Object *marioObj = m->marioObj; struct Object *whirlpool = m->usedObj; + // sanity check + if (marioObj == NULL || whirlpool == NULL) { + return FALSE; + } + f32 dx = m->pos[0] - whirlpool->oPosX; f32 dz = m->pos[2] - whirlpool->oPosZ; f32 distance = sqrtf(dx * dx + dz * dz);