Add some bounds checking in the preferences dialog

Originally committed to SVN as r4841.
This commit is contained in:
Thomas Goyne 2010-11-11 04:48:29 +00:00
parent 6a186d0bcb
commit 7a38c1c06e
1 changed files with 2 additions and 1 deletions

View File

@ -170,7 +170,8 @@ void OptionPage::OptionChoice(wxFlexGridSizer *&flex, const wxString &name, cons
switch (opt->GetType()) {
case agi::OptionValue::Type_Int: {
cb->SetValue(choices[opt->GetInt()]);
int val = opt->GetInt();
cb->SetValue(choices[val < (int)choices.size() ? val : opt->GetDefaultInt()]);
cb->Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, IntCBUpdater(opt_name, parent));
break;
}