Simpler #634, always use the first choice when out of bounds

This commit is contained in:
vsonnier 2018-03-24 07:06:27 +01:00
parent 4cd8735014
commit 120d394f01

View File

@ -502,16 +502,12 @@ std::string SDRDevicesDialog::getSelectedChoiceOption(wxPGProperty* prop, const
if (choiceIndex >= 0 && choiceIndex < arg.options.size()) { if (choiceIndex >= 0 && choiceIndex < arg.options.size()) {
//normal selection //normal selection
optionName = arg.options[choiceIndex]; optionName = arg.options[choiceIndex];
} else if (choiceIndex >= arg.options.size()) { } else {
//choose the last one of the list:
optionName = arg.options[arg.options.size() - 1];
prop->SetChoiceSelection(arg.options.size() - 1);
} else if (choiceIndex < 0) {
//choose the first one of the list: //choose the first one of the list:
optionName = arg.options[0]; optionName = arg.options[0];
prop->SetChoiceSelection(0); prop->SetChoiceSelection(0);
} }
} }
return optionName; return optionName;
} }