From b1478043ba4285fb69c4835d373da508ab94dac6 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 20 May 2018 20:11:21 -0700 Subject: [PATCH] Add range check getting sloppy not checking myself --- PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs b/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs index fe3cd7be6..38af1a13f 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs @@ -207,12 +207,14 @@ namespace PKHeX.WinForms int memory = WinFormsUtil.GetIndex((ComboBox) sender); var memIndex = Memories.GetMemoryArgType(memory); var argvals = GameInfo.Strings.Memories.GetArgumentStrings(memIndex); + int index = (int) memIndex - 1; if (sender == CB_CTMemory) { CB_CTVar.DisplayMember = nameof(ComboItem.Text); CB_CTVar.ValueMember = nameof(ComboItem.Value); CB_CTVar.DataSource = argvals; - LCTV.Text = vartypes[(int)memIndex - 1]; + if (index >= 0) + LCTV.Text = vartypes[index]; LCTV.Visible = CB_CTVar.Visible = CB_CTVar.Enabled = argvals.Count > 1; } else @@ -220,7 +222,8 @@ namespace PKHeX.WinForms CB_OTVar.DisplayMember = nameof(ComboItem.Text); CB_OTVar.ValueMember = nameof(ComboItem.Value); CB_OTVar.DataSource = argvals; - LOTV.Text = vartypes[(int)memIndex - 1]; + if (index >= 0) + LOTV.Text = vartypes[index]; LOTV.Visible = CB_OTVar.Visible = CB_OTVar.Enabled = argvals.Count > 1; } }