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 #3906
This commit is contained in:
parent
f94c4f4420
commit
05be679d9a
1 changed files with 9 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue