mirror of
https://github.com/libsm64/libsm64.git
synced 2025-01-22 07:32:04 -05:00
Merge pull request #42 from kafeijao/prevent-hangable-crash
Prevent SURFACE_HANGABLE crashes
This commit is contained in:
commit
5206fd298f
1 changed files with 3 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue