From ca54f774abb5c3fb193629d3850f75d777259efd Mon Sep 17 00:00:00 2001 From: MysterD Date: Wed, 8 Nov 2023 13:09:58 -0800 Subject: [PATCH] Fix crash in init_level() --- src/game/level_update.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/level_update.c b/src/game/level_update.c index a7c50e22..07560348 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -1738,7 +1738,7 @@ s32 init_level(void) { if (gCurrDemoInput != NULL) { set_mario_action(gMarioState, ACT_IDLE, 0); } else if (!gDebugLevelSelect) { - if (gMarioState->action != ACT_UNINITIALIZED) { + if (gMarioState && gMarioState->action != ACT_UNINITIALIZED) { bool skipIntro = (gNetworkType == NT_NONE || gServerSettings.skipIntro != 0); if (gDjuiInMainMenu && (gNetworkType == NT_NONE)) { // pick random main menu level @@ -1770,7 +1770,7 @@ s32 init_level(void) { play_transition(WARP_TRANSITION_FADE_FROM_STAR, 0x10, 0xFF, 0xFF, 0xFF); } - if (gCurrDemoInput == NULL) { + if (gCurrDemoInput == NULL && gCurrentArea) { set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0); } } @@ -1779,7 +1779,7 @@ s32 init_level(void) { cancel_rumble(); } - if (gMarioState->action == ACT_INTRO_CUTSCENE) { + if (gMarioState && gMarioState->action == ACT_INTRO_CUTSCENE) { sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_DISABLED_DURING_INTRO_CUTSCENE); }