From eb5c753db0b1a086218c40d640eedb3bdfc9b7e4 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 30 Apr 2016 14:23:56 -0700 Subject: [PATCH] Fix iterator for wc6 checking relearn The .Remove was tampering with the same variable that the foreach was iterating over, causing exceptions. By casting to a WC6[], the List can be altered and the array is iterated over instead. --- Legality/Checks.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Legality/Checks.cs b/Legality/Checks.cs index 63f380b40..c5dbd40e0 100644 --- a/Legality/Checks.cs +++ b/Legality/Checks.cs @@ -776,7 +776,7 @@ private LegalityCheck[] verifyRelearn() { // Get WC6's that match CardMatch = new List(Legal.getValidWC6s(pk6)); - foreach (var wc in CardMatch) + foreach (var wc in CardMatch.ToArray()) { int[] moves = wc.RelearnMoves; for (int i = 0; i < 4; i++)