[P1] Fix party UI crash from unsanitized lastCursor pointing to empty Pokemon slot (#4672)

This commit is contained in:
PigeonBar 2024-10-16 11:10:35 -04:00 committed by GitHub
parent 72c08e5cfd
commit 1907824670
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -671,6 +671,9 @@ export default class PartyUiHandler extends MessageUiHandler {
} else if (this.cursor === 6) { } else if (this.cursor === 6) {
this.partyCancelButton.select(); this.partyCancelButton.select();
} }
if (this.lastCursor < 6 && this.lastCursor >= party.length) {
this.lastCursor = party.length - 1;
}
for (const p in party) { for (const p in party) {
const slotIndex = parseInt(p); const slotIndex = parseInt(p);