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);