diff --git a/mm/2s2h/z_scene_2SH.cpp b/mm/2s2h/z_scene_2SH.cpp index e10710038..b51c0e75f 100644 --- a/mm/2s2h/z_scene_2SH.cpp +++ b/mm/2s2h/z_scene_2SH.cpp @@ -170,7 +170,7 @@ void Scene_CommandObjectList(PlayState* play, LUS::ISceneCommand* cmd) { // Loop until a mismatch in the object lists // Then clear all object ids past that in the context object list and kill actors for those objects for (i = play->objectCtx.numPersistentEntries, k = 0; i < play->objectCtx.numEntries; i++, k++) { - if (play->objectCtx.slots[i].id != objList->objects[k]) { + if (k >= objList->objects.size() || play->objectCtx.slots[i].id != objList->objects[k]) { for (j = i; j < play->objectCtx.numEntries; j++) { play->objectCtx.slots[j].id = 0; } @@ -523,4 +523,4 @@ extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomN } return 0; -} \ No newline at end of file +}