From db655c67465543fdf1e86967375cbf188d48fc59 Mon Sep 17 00:00:00 2001 From: MysterD Date: Mon, 21 Feb 2022 00:00:53 -0800 Subject: [PATCH] Fix crash in is_anim_past_end --- src/game/mario.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/game/mario.c b/src/game/mario.c index befa94b36..09176a8fd 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -70,8 +70,10 @@ s32 is_anim_at_end(struct MarioState *m) { * Checks if Mario's animation has surpassed 2 frames before its end point. */ s32 is_anim_past_end(struct MarioState *m) { + if (m == NULL || m->marioObj == NULL) { return 0; } struct Object *o = m->marioObj; + if (o->header.gfx.animInfo.curAnim == NULL) { return 0; } return o->header.gfx.animInfo.animFrame >= (o->header.gfx.animInfo.curAnim->loopEnd - 2); }