From eb49053e73f86233c2e93e3aae06e4e2bdc45c11 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 21 Jul 2022 18:35:30 -0400 Subject: [PATCH] Prevent unrestricted items camera crash (#852) --- soh/src/code/z_room.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index ab3d04721d5..04f2d421b41 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -402,6 +402,12 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { camera = GET_ACTIVE_CAM(globalCtx); camId = camera->camDataIdx; + if (camId == -1 && CVar_GetS32("gNoRestrictItems", 0)) { + // This prevents a crash when using items that change the + // camera (such as din's fire) on scenes with prerendered backgrounds + return NULL; + } + // jfifid camId2 = func_80041C10(&globalCtx->colCtx, camId, BGCHECK_SCENE)[2].y; if (camId2 >= 0) {