Commit 96c85d1c authored by Nicolas Fella's avatar Nicolas Fella Committed by Nate Graham
Browse files

Gracefully handle invalid color scheme setting

When for whatever reason ColorScheme from kdeglobals point to a nonexistant scheme then no entry for m_palettes[QPlatformTheme::SystemPalette] is created, leading to a crash down the line

Instead fall back to BreezeLight to avoid a crash

BUG: 449613


(cherry picked from commit df7ed806)
parent ce322eac
Pipeline #134477 passed with stage
in 1 minute and 4 seconds
......@@ -434,9 +434,12 @@ void KHintsSettings::loadPalettes()
const QString scheme = readConfigValue(QStringLiteral("General"), QStringLiteral("ColorScheme"), QStringLiteral("BreezeLight")).toString();
path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("color-schemes/") + scheme + QStringLiteral(".colors"));
if (!path.isEmpty()) {
m_palettes[QPlatformTheme::SystemPalette] = new QPalette(KColorScheme::createApplicationPalette(KSharedConfig::openConfig(path)));
if (path.isEmpty()) {
qWarning() << "Could not find color scheme" << scheme << "falling back to BreezeLight";
path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("color-schemes/BreezeLight.colors"));
}
m_palettes[QPlatformTheme::SystemPalette] = new QPalette(KColorScheme::createApplicationPalette(KSharedConfig::openConfig(path)));
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment