From 17553e6b6a61f42e1fa6ec0a6b8d8e5fc24774c5 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 6 Jun 2018 21:51:43 -0700 Subject: [PATCH] Fix parse exception deleting tid/sid text -> int.Parse("") fails --- PKHeX.WinForms/Controls/PKM Editor/TrainerID.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PKHeX.WinForms/Controls/PKM Editor/TrainerID.cs b/PKHeX.WinForms/Controls/PKM Editor/TrainerID.cs index 0653011cf..e93cf9401 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/TrainerID.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/TrainerID.cs @@ -114,7 +114,7 @@ namespace PKHeX.WinForms.Controls if (!(sender is MaskedTextBox mt)) return; - var val = int.Parse(mt.Text); + int.TryParse(mt.Text, out var val); if (mt == TB_TID7) { if (val > 999_999) @@ -122,7 +122,8 @@ namespace PKHeX.WinForms.Controls mt.Text = "999999"; return; } - SanityCheckSID7(val, int.Parse(TB_SID7.Text)); + int.TryParse(TB_SID7.Text, out var sid); + SanityCheckSID7(val, sid); } else if (mt == TB_SID7) { @@ -131,7 +132,8 @@ namespace PKHeX.WinForms.Controls mt.Text = "4294"; return; } - SanityCheckSID7(int.Parse(TB_TID7.Text), val); + int.TryParse(TB_TID7.Text, out var tid); + SanityCheckSID7(tid, val); } else {