From fe6f72ec52696d6897bcbbc46a0a197e3d942955 Mon Sep 17 00:00:00 2001 From: hedara90 <90hedara@gmail.com> Date: Thu, 18 Dec 2025 22:56:42 +0100 Subject: [PATCH] Fix party pool oob (#8581) --- src/trainer_pools.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/trainer_pools.c b/src/trainer_pools.c index 6f0e57fdb2..faf93fcc9e 100644 --- a/src/trainer_pools.c +++ b/src/trainer_pools.c @@ -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;