mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-11 21:22:41 +00:00
Add range check
getting sloppy not checking myself
This commit is contained in:
parent
bbe6762d24
commit
b1478043ba
1 changed files with 5 additions and 2 deletions
|
@ -207,12 +207,14 @@ namespace PKHeX.WinForms
|
||||||
int memory = WinFormsUtil.GetIndex((ComboBox) sender);
|
int memory = WinFormsUtil.GetIndex((ComboBox) sender);
|
||||||
var memIndex = Memories.GetMemoryArgType(memory);
|
var memIndex = Memories.GetMemoryArgType(memory);
|
||||||
var argvals = GameInfo.Strings.Memories.GetArgumentStrings(memIndex);
|
var argvals = GameInfo.Strings.Memories.GetArgumentStrings(memIndex);
|
||||||
|
int index = (int) memIndex - 1;
|
||||||
if (sender == CB_CTMemory)
|
if (sender == CB_CTMemory)
|
||||||
{
|
{
|
||||||
CB_CTVar.DisplayMember = nameof(ComboItem.Text);
|
CB_CTVar.DisplayMember = nameof(ComboItem.Text);
|
||||||
CB_CTVar.ValueMember = nameof(ComboItem.Value);
|
CB_CTVar.ValueMember = nameof(ComboItem.Value);
|
||||||
CB_CTVar.DataSource = argvals;
|
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;
|
LCTV.Visible = CB_CTVar.Visible = CB_CTVar.Enabled = argvals.Count > 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -220,7 +222,8 @@ namespace PKHeX.WinForms
|
||||||
CB_OTVar.DisplayMember = nameof(ComboItem.Text);
|
CB_OTVar.DisplayMember = nameof(ComboItem.Text);
|
||||||
CB_OTVar.ValueMember = nameof(ComboItem.Value);
|
CB_OTVar.ValueMember = nameof(ComboItem.Value);
|
||||||
CB_OTVar.DataSource = argvals;
|
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;
|
LOTV.Visible = CB_OTVar.Visible = CB_OTVar.Enabled = argvals.Count > 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue