From 3111a8dc62cb31ed857556455cc019cdbcb6da14 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 26 Jan 2020 23:58:14 -0800 Subject: [PATCH] Cast the array a little safer bad hacks with invalid future gen evolutions yield no evolution data, which results in empty arrays. --- .../Legality/Encounters/Information/ValidEncounterMoves.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs b/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs index 5c23c828f..eca710ee1 100644 --- a/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs +++ b/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs @@ -21,8 +21,8 @@ public ValidEncounterMoves(PKM pkm, LevelUpRestriction restrict, IEncounterable { var level = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, minLvLG1: restrict.MinimumLevelGen1, minLvLG2: restrict.MinimumLevelGen2, Tutor: false, Machine: false, RemoveTransferHM: false); - if (encounter is IGeneration g) - AddEdgeCaseMoves((List)level[g.Generation], encounter, pkm); + if (encounter is IGeneration g && level[g.Generation] is List x) + AddEdgeCaseMoves(x, encounter, pkm); LevelUpMoves = level; TMHMMoves = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, LVL: false, Tutor: false, MoveReminder: false, RemoveTransferHM: false);