Add safety measure to Scene_CommandObjectList to prevent crash (#3904)

* dont let k overflow

* Update soh/soh/z_scene_otr.cpp

Co-authored-by: Archez <Archez@users.noreply.github.com>

---------

Co-authored-by: Archez <Archez@users.noreply.github.com>
This commit is contained in:
inspectredc 2024-02-16 01:38:54 +00:00 committed by GitHub
parent bb1078e99c
commit 107a365b71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -178,7 +178,7 @@ bool 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.unk_09, k = 0; i < play->objectCtx.num; i++, k++) {
if (play->objectCtx.status[i].id != cmdObj->objects[k]) {
if (i >= cmdObj->objects.size() || play->objectCtx.status[i].id != cmdObj->objects[k]) {
for (j = i; j < play->objectCtx.num; j++) {
play->objectCtx.status[j].id = OBJECT_INVALID;
}