From b60b5e3c07d29d5a7abe36827c3e13ddbec44faa Mon Sep 17 00:00:00 2001 From: MysterD Date: Sun, 10 Apr 2022 18:19:15 -0700 Subject: [PATCH] Possible fix for init_mario_after_warp() crash --- src/game/level_update.c | 5 +++-- src/pc/lua/utils/smlua_audio_utils.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/game/level_update.c b/src/game/level_update.c index 9a9e0fbd..b35a0357 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -392,8 +392,9 @@ void set_mario_initial_action(struct MarioState *m, u32 spawnType, u32 actionArg void init_mario_after_warp(void) { struct ObjectWarpNode *spawnNode = area_get_warp_node(sWarpDest.nodeId); - if (spawnNode == NULL) { spawnNode = gCurrentArea->warpNodes; } - if (spawnNode == NULL) { return; } + if (spawnNode == NULL || spawnNode->object == NULL) { spawnNode = &gCurrentArea->warpNodes[0xFA]; } + if (spawnNode == NULL || spawnNode->object == NULL) { spawnNode = &gCurrentArea->warpNodes[0x00]; } + if (spawnNode == NULL || spawnNode->object == NULL) { return; } u32 marioSpawnType = get_mario_spawn_type(spawnNode->object); if (gMarioState->action != ACT_UNINITIALIZED) { diff --git a/src/pc/lua/utils/smlua_audio_utils.c b/src/pc/lua/utils/smlua_audio_utils.c index 228d6444..fcc60e7e 100644 --- a/src/pc/lua/utils/smlua_audio_utils.c +++ b/src/pc/lua/utils/smlua_audio_utils.c @@ -99,7 +99,7 @@ void smlua_audio_utils_replace_sequence(u8 sequenceId, u8 bankId, u8 defaultVolu char m64path[SYS_MAX_PATH] = { 0 }; if (snprintf(m64path, SYS_MAX_PATH-1, "sound/%s.m64", m64Name) < 0) { - LOG_LUA("Could not find m64 at path: %s", m64path); + LOG_LUA("Could not concat m64path: %s", m64path); return; }