From ad721f81c38f22c90c442a77057d1b21ce4a0ae3 Mon Sep 17 00:00:00 2001 From: collecting Date: Tue, 23 Sep 2025 12:11:31 +0000 Subject: [PATCH] std::vector::at() crash fix --- src/citron/configuration/shared_widget.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/citron/configuration/shared_widget.cpp b/src/citron/configuration/shared_widget.cpp index 5e1465a46..4669487b1 100644 --- a/src/citron/configuration/shared_widget.cpp +++ b/src/citron/configuration/shared_widget.cpp @@ -152,7 +152,15 @@ QWidget* Widget::CreateCombobox(std::function& 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();