summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pokemon_storage_system.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c
index db8f3d2bb..4be1cf729 100644
--- a/src/pokemon_storage_system.c
+++ b/src/pokemon_storage_system.c
@@ -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++;
}