From 0bb7adfd2d7d5f98783ec7c2586be811a6a1fa95 Mon Sep 17 00:00:00 2001 From: MysterD Date: Wed, 3 May 2023 13:13:11 -0700 Subject: [PATCH] Fix crash in bhv_lll_bowser_puzzle_piece_update() --- src/game/behaviors/bowser_puzzle_piece.inc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/game/behaviors/bowser_puzzle_piece.inc.c b/src/game/behaviors/bowser_puzzle_piece.inc.c index c6eb63385..7d57014f8 100644 --- a/src/game/behaviors/bowser_puzzle_piece.inc.c +++ b/src/game/behaviors/bowser_puzzle_piece.inc.c @@ -181,9 +181,10 @@ void bhv_lll_bowser_puzzle_piece_action_1(void) { */ void bhv_lll_bowser_puzzle_piece_update(void) { s8* nextAction = o->oBowserPuzzlePieceNextAction; + if (!nextAction) { return; } // If Mario is standing on this puzzle piece, set a flag in the parent. - if (cur_obj_is_any_player_on_platform()) + if (cur_obj_is_any_player_on_platform() && o->parentObj) o->parentObj->oBowserPuzzleCompletionFlags = 1; // If we should advance to the next action... @@ -199,7 +200,9 @@ void bhv_lll_bowser_puzzle_piece_update(void) { // If we're at the end of the list... if (*nextAction == -1) { // Set the other completion flag in the parent. - o->parentObj->oBowserPuzzleCompletionFlags |= 2; + if (o->parentObj) { + o->parentObj->oBowserPuzzleCompletionFlags |= 2; + } // The next action is the first action in the list again. o->oBowserPuzzlePieceNextAction = o->oBowserPuzzlePieceActionList;