mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 18:46:55 -05:00
Catch & Rethrow getFieldsfromPKM
Initialization variable is captured, reset, then the pkm is loaded. If an exception is thrown, the initialization state is not restored. There's other capture-reset-restore cases but pkm loading is the only one exposed to bad input. Should prevent #261 from happening. fieldsInitialized is checked in a bunch of events.
This commit is contained in:
@@ -1382,7 +1382,8 @@ public void populateFields(PKM pk, bool focus = true)
|
||||
Util.Alert("Converted File.");
|
||||
}
|
||||
|
||||
getFieldsfromPKM();
|
||||
try { getFieldsfromPKM(); }
|
||||
catch { fieldsInitialized = oldInit; throw; }
|
||||
|
||||
CB_EncounterType.Visible = Label_EncounterType.Visible = pkm.Gen4;
|
||||
fieldsInitialized = oldInit;
|
||||
|
||||
Reference in New Issue
Block a user