diff --git a/PKHeX.Core/Editing/CommonEdits.cs b/PKHeX.Core/Editing/CommonEdits.cs index 7bf47f33d..62d085277 100644 --- a/PKHeX.Core/Editing/CommonEdits.cs +++ b/PKHeX.Core/Editing/CommonEdits.cs @@ -683,5 +683,21 @@ public static string GetPotentialString(this PKM pk, bool unicode = true) var arr = unicode ? PotentialUnicode : PotentialNoUnicode; return arr[pk.PotentialRating]; } + + // Extensions + /// + /// Gets the Location Name for the + /// + /// PKM to fetch data for + /// Location requested is the egg obtained location, not met location. + /// Location string + public static string GetLocationString(this PKM pk, bool eggmet) + { + if (pk.Format < 2) + return string.Empty; + + int locval = eggmet ? pk.Egg_Location : pk.Met_Location; + return GameInfo.GetLocationName(eggmet, locval, pk.Format, pk.GenNumber, (GameVersion)pk.Version); + } } } diff --git a/PKHeX.Core/PKM/Util/PKX.cs b/PKHeX.Core/PKM/Util/PKX.cs index 3319cdfde..3d9c9a672 100644 --- a/PKHeX.Core/PKM/Util/PKX.cs +++ b/PKHeX.Core/PKM/Util/PKX.cs @@ -820,22 +820,6 @@ public static int GetPKMFormatFromExtension(char last, int prefer) return last == 'x' ? 6 : prefer; } - // Extensions - /// - /// Gets the Location Name for the - /// - /// PKM to fetch data for - /// Location requested is the egg obtained location, not met location. - /// Location string - public static string GetLocationString(this PKM pk, bool eggmet) - { - if (pk.Format < 2) - return string.Empty; - - int locval = eggmet ? pk.Egg_Location : pk.Met_Location; - return GameInfo.GetLocationName(eggmet, locval, pk.Format, pk.GenNumber, (GameVersion)pk.Version); - } - /// /// Copies a list to the destination list, with an option to copy to a starting point. /// @@ -887,7 +871,7 @@ public static int CopyTo(this IEnumerable list, IList dest, int start = int ctr = start; foreach (var z in list) { - if (dest.Count <= ctr) + if (ctr >= dest.Count) break; dest[ctr++] = z; }