From 5e637bd12115b0cea1de89eeca035aeed70ce501 Mon Sep 17 00:00:00 2001 From: IvanDSM Date: Sun, 17 May 2020 21:23:30 -0300 Subject: [PATCH] Fix crashing when OOB in BETTERCAMERA builds Previously, an attempt to read gMarioState->floor->type was being made even when gMarioState->floor was a null pointer. This commit makes bettercamera check if gMarioState->floor is not null before accessing it. --- src/game/bettercamera.inc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/bettercamera.inc.h b/src/game/bettercamera.inc.h index 0f58b2e8..f585447c 100644 --- a/src/game/bettercamera.inc.h +++ b/src/game/bettercamera.inc.h @@ -617,7 +617,7 @@ static void newcam_apply_values(struct Camera *c) gLakituState.yaw = -newcam_yaw+0x4000; //Adds support for wing mario tower - if (gMarioState->floor->type == SURFACE_LOOK_UP_WARP) { + if (gMarioState->floor && gMarioState->floor->type == SURFACE_LOOK_UP_WARP) { if (save_file_get_total_star_count(gCurrSaveFileNum - 1, 0, 0x18) >= 10) { if (newcam_tilt < -8000 && gMarioState->forwardVel == 0) { level_trigger_warp(gMarioState, 1);