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

Pick-to: qds/4.7
Change-Id: I46acf97749d148edc45bd33d31815d7f7e96942b
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Tim Jenßen
2025-06-04 10:32:38 +02:00
committed by Tim Jenssen
parent c486e78d37
commit 2c8ff3da47

View File

@@ -295,6 +295,7 @@ void GeneralSettingsWidget::apply()
setDpiPolicy(selectedPolicy);
}
currentIndex = m_codecBox->currentIndex();
if (currentIndex != -1)
setCodecForLocale(m_codecBox->itemText(currentIndex).toLocal8Bit());
// Apply the new base color if accepted
StyleHelper::setBaseColor(m_colorButton->color());