mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-20 19:13:56 +00:00
std::vector::at() crash fix
This commit is contained in:
@@ -152,7 +152,15 @@ QWidget* Widget::CreateCombobox(std::function<std::string()>& serializer,
|
||||
};
|
||||
|
||||
const u32 setting_value = std::strtoul(setting.ToString().c_str(), nullptr, 0);
|
||||
combobox->setCurrentIndex(find_index(setting_value));
|
||||
const int index = find_index(setting_value);
|
||||
|
||||
if (index != -1) {
|
||||
combobox->setCurrentIndex(index);
|
||||
} else {
|
||||
LOG_WARNING(Frontend, "Could not find current setting for combobox '{}'. Defaulting to first item.", setting.GetLabel());
|
||||
// If not found, safely select the first item in the list instead of an invalid one.
|
||||
combobox->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
serializer = [this, enumeration]() {
|
||||
int current = combobox->currentIndex();
|
||||
|
||||
Reference in New Issue
Block a user