From a2c8a174341183f054275b801a848b11befbefb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Jen=C3=9Fen?= Date: Wed, 4 Jun 2025 10:32:38 +0200 Subject: [PATCH] Core: fix rare crash in GeneralSettingsWidget::apply() The codec box might not contain any items maybe the list failed to populate found in https://the-qt-company-00.sentry.io/issues/6367744991 Change-Id: I46acf97749d148edc45bd33d31815d7f7e96942b Reviewed-by: Thomas Hartmann (cherry picked from commit 2c8ff3da47be8b6bcbb1490a3ce3bf9c9ce6ce0a) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/coreplugin/generalsettings.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 6fac2ca101b..d5a9a4a3981 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -295,7 +295,8 @@ void GeneralSettingsWidget::apply() setDpiPolicy(selectedPolicy); } currentIndex = m_codecBox->currentIndex(); - setCodecForLocale(m_codecBox->itemText(currentIndex).toLocal8Bit()); + if (currentIndex != -1) + setCodecForLocale(m_codecBox->itemText(currentIndex).toLocal8Bit()); // Apply the new base color if accepted StyleHelper::setBaseColor(m_colorButton->color()); m_themeChooser->apply();