Fixed crash in act_caught_in_whirlpool

This commit is contained in:
MysterD 2022-04-13 01:37:07 -07:00
parent ce52fe4c1d
commit 9793b56f84
1 changed files with 5 additions and 0 deletions

View File

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