Add UBFIX for null deref in sub_80D08CC

This commit is contained in:
Sierraffinity 2020-12-26 17:47:36 -08:00
parent 86fdd033c6
commit bafbf9240d

View File

@ -8408,8 +8408,13 @@ static void sub_80D08CC(void)
for (j = sMoveMonsPtr->minRow; j < rowCount; j++)
{
struct BoxPokemon *boxMon = GetBoxedMonPtr(boxId, boxPosition);
// UB: possible null dereference
#ifdef UBFIX
if (boxMon != NULL)
sMoveMonsPtr->boxMons[monArrayId] = *boxMon;
#else
sMoveMonsPtr->boxMons[monArrayId] = *boxMon;
#endif
monArrayId++;
boxPosition++;
}