UB fix in Bolse's Event Handler update function

This commit is contained in:
Sonic Dreamcaster 2024-11-17 15:32:41 -03:00
parent 79a05aa6dc
commit af6164e353

View File

@ -203,7 +203,7 @@ void Bolse_SpawnEnemies(ActorEvent* this, s32 count) {
}
void Bolse_UpdateEventHandler(ActorEvent* this) {
s32 i;
s32 i = 0;
Player* player = &gPlayer[0];
s32 pad;
Actor* actor;
@ -352,7 +352,12 @@ void Bolse_UpdateEventHandler(ActorEvent* this) {
case 10:
if (gBosses[1].obj.status != 0) {
if (fabsf(Math_SmoothStepToF(&gBosses[1].scale, 0.0f, 1.0f, 0.05f, 0.001f)) < 0.05f) {
// @bug: i is uninitialized and likely contains stack garbage.
#ifdef AVOID_UB
Object_Kill(&gBosses[1].obj, gBosses[1].sfxSource);
#else
Object_Kill(&gBosses[1].obj, gBosses[i].sfxSource);
#endif
gLight1R = 100;
gLight1G = 100;
gLight1B = 80;