Prevent SURFACE_HANGABLE crash (from ckosmic branch)

This commit is contained in:
kafeijao
2023-03-05 13:47:07 +00:00
parent 4842cd3ed8
commit d42bb76023
+3 -4
View File
@@ -412,8 +412,7 @@ s32 act_start_hanging(struct MarioState *m) {
return set_mario_action(m, ACT_GROUND_POUND, 0);
}
//! Crash if Mario's referenced ceiling is NULL (same for other hanging actions)
if (m->ceil->type != SURFACE_HANGABLE) {
if (m->ceil == NULL || m->ceil->type != SURFACE_HANGABLE) {
return set_mario_action(m, ACT_FREEFALL, 0);
}
@@ -441,7 +440,7 @@ s32 act_hanging(struct MarioState *m) {
return set_mario_action(m, ACT_GROUND_POUND, 0);
}
if (m->ceil->type != SURFACE_HANGABLE) {
if (m->ceil == NULL || m->ceil->type != SURFACE_HANGABLE) {
return set_mario_action(m, ACT_FREEFALL, 0);
}
@@ -465,7 +464,7 @@ s32 act_hang_moving(struct MarioState *m) {
return set_mario_action(m, ACT_GROUND_POUND, 0);
}
if (m->ceil->type != SURFACE_HANGABLE) {
if (m->ceil == NULL || m->ceil->type != SURFACE_HANGABLE) {
return set_mario_action(m, ACT_FREEFALL, 0);
}