mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-14 00:07:15 +00:00
Add array sanitization if error was thrown
This commit is contained in:
parent
a07549f013
commit
f7423daf7a
1 changed files with 10 additions and 0 deletions
|
@ -120,6 +120,16 @@ namespace PKHeX.Core
|
|||
{
|
||||
System.Diagnostics.Debug.WriteLine(e.Message);
|
||||
Valid = false;
|
||||
|
||||
// Moves and Relearn arrays can potentially be empty on error.
|
||||
// ReSharper disable once ConstantNullCoalescingCondition
|
||||
for (int i = 0; i < Info.Moves.Length; i++)
|
||||
Info.Moves[i] ??= new CheckMoveResult(MoveSource.None, pkm.Format, Severity.Indeterminate, L_AError, CheckIdentifier.CurrentMove);
|
||||
|
||||
// ReSharper disable once ConstantNullCoalescingCondition
|
||||
for (int i = 0; i < Info.Relearn.Length; i++)
|
||||
Info.Relearn[i] ??= new CheckResult(Severity.Indeterminate, L_AError, CheckIdentifier.CurrentMove);
|
||||
|
||||
AddLine(Severity.Invalid, L_AError, CheckIdentifier.Misc);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue