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.
This commit is contained in:
IvanDSM 2020-05-17 21:23:30 -03:00
parent 2287fcce9f
commit 5e637bd121
1 changed files with 1 additions and 1 deletions

View File

@ -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);