From d09f5528cc51a91337c77aa153104189b83349bb Mon Sep 17 00:00:00 2001 From: Sonic Dreamcaster Date: Sat, 16 Nov 2024 10:07:32 -0300 Subject: [PATCH] fix Zoness Boss crash --- src/overlays/ovl_i3/fox_zo.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/overlays/ovl_i3/fox_zo.c b/src/overlays/ovl_i3/fox_zo.c index 4fe09307..696ab3dd 100644 --- a/src/overlays/ovl_i3/fox_zo.c +++ b/src/overlays/ovl_i3/fox_zo.c @@ -3212,10 +3212,10 @@ void Zoness_ZoSarumarine_Update(ZoSarumarine* this) { } void Zoness_801986FC(ZoSarumarine* this, s32 arg1, f32 xOff, f32 yOff, f32 zOff, f32 yRot) { - ZoBall* actor245; + ZoBall* actor245 = NULL; Vec3f src = { 0.0f, 0.0f, 50.0f }; - Vec3f dest; - s32 i; + Vec3f dest = { 0 }; + s32 i = 0; if ((sZoSwork[ZO_BSS_0 + arg1] == 0) && (sZoSwork[ZO_BSS_11 + arg1] != 0)) { sZoSwork[ZO_BSS_0 + arg1] = 70; @@ -3268,9 +3268,19 @@ void Zoness_801986FC(ZoSarumarine* this, s32 arg1, f32 xOff, f32 yOff, f32 zOff, } } - if (i < ARRAY_COUNT(gActors)) { + if (i >= ARRAY_COUNT(gActors)) { + actor245 = NULL; + } + + if (actor245 != NULL) { actor245->obj.status = OBJ_FREE; } + + if (i < ARRAY_COUNT(gActors)) { + if (actor245 != NULL) { + actor245->obj.status = OBJ_FREE; + } + } } void Zoness_801989FC(ZoSarumarine* this) {