2
0
Fork 0
mirror of https://github.com/kwsch/PKHeX synced 2025-03-07 08:47:21 +00:00

LearnPossible: Add len check for relearn move

Out of bounds relearn move IDs weren't sanity checked; now they are.
Closes 
This commit is contained in:
Kurt 2023-06-07 18:11:08 -07:00
parent f94c4f4420
commit 05be679d9a

View file

@ -42,10 +42,15 @@ public static class LearnPossible
}
else if (enc.Generation >= 6)
{
result[pk.RelearnMove1] = true;
result[pk.RelearnMove2] = true;
result[pk.RelearnMove3] = true;
result[pk.RelearnMove4] = true;
static void AddIfInRange(ushort move, Span<bool> result)
{
if (move < result.Length)
result[move] = true;
}
AddIfInRange(pk.RelearnMove1, result);
AddIfInRange(pk.RelearnMove2, result);
AddIfInRange(pk.RelearnMove3, result);
AddIfInRange(pk.RelearnMove4, result);
}
}