Add guard check for out of range gen1 species

Thanks ShadowMario3!
This commit is contained in:
Kurt
2017-11-17 17:07:12 -08:00
parent 1ea29eb66c
commit 523c03606e

View File

@@ -21,7 +21,7 @@ internal static class SpeciesConverter
/// </summary>
/// <param name="dex_id">National Dex ID.</param>
/// <returns>Generation 1 species ID.</returns>
public static int SetG1Species(int dex_id) => table1_Internal[dex_id];
public static int SetG1Species(int dex_id) => dex_id >= table1_Internal.Length ? 0 : table1_Internal[dex_id];
/// <summary>
/// Converts a National Dex ID to Generation 3 species ID.