Fix party pool oob (#8581)

This commit is contained in:
hedara90 2025-12-18 22:56:42 +01:00 committed by GitHub
parent cd856cfc40
commit fe6f72ec52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,6 +167,10 @@ static u32 PickMonFromPool(const struct Trainer *trainer, u8 *poolIndexArray, u3
// If no mon has been found yet continue looking
if (monIndex == POOL_SLOT_DISABLED)
monIndex = pickFunctions.OtherFunction(trainer, poolIndexArray, partyIndex, monsCount, battleTypeFlags, rules);
// If a mon still hasn't been found, return POOL_SLOT_DISABLED which makes party generation default to regular party generation
if (monIndex == POOL_SLOT_DISABLED)
return monIndex;
u32 chosenTags = trainer->party[monIndex].tags;
u16 chosenSpecies = trainer->party[monIndex].species;
u16 chosenItem = trainer->party[monIndex].heldItem;