mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-28 20:36:50 -05:00
Fix NullReferenceException in legality checks
This commit is contained in:
@@ -9,6 +9,12 @@ public partial class LegalityAnalysis
|
||||
private PKM pkm;
|
||||
private readonly List<CheckResult> Parse = new List<CheckResult>();
|
||||
|
||||
private enum Encounters
|
||||
{
|
||||
Unknown = -1,
|
||||
Generic = 0
|
||||
}
|
||||
|
||||
private object EncounterMatch;
|
||||
private Type EncounterType;
|
||||
private bool EncounterIsMysteryGift => EncounterType.IsSubclassOf(typeof (MysteryGift));
|
||||
@@ -95,6 +101,10 @@ private void updateMoveLegality()
|
||||
private void updateChecks()
|
||||
{
|
||||
Encounter = verifyEncounter();
|
||||
|
||||
// If EncounterMatch is null, nullrefexception will prevent a lot of analysis from happening at all.
|
||||
EncounterMatch = EncounterMatch ?? Encounters.Unknown;
|
||||
|
||||
EncounterType = EncounterMatch?.GetType();
|
||||
if (EncounterType == typeof (MysteryGift))
|
||||
EncounterType = EncounterType.BaseType;
|
||||
|
||||
Reference in New Issue
Block a user