diff options
Diffstat (limited to 'src/plugins/coreplugin/themechooser.cpp')
-rw-r--r-- | src/plugins/coreplugin/themechooser.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/coreplugin/themechooser.cpp b/src/plugins/coreplugin/themechooser.cpp index 6f81aaa950..ff62406dba 100644 --- a/src/plugins/coreplugin/themechooser.cpp +++ b/src/plugins/coreplugin/themechooser.cpp @@ -221,8 +221,16 @@ QList<ThemeEntry> ThemeEntry::availableThemes() Id ThemeEntry::themeSetting() { - return Id::fromSetting(ICore::settings()->value(QLatin1String(Constants::SETTINGS_THEME), - QLatin1String(Constants::DEFAULT_THEME))); + const Id setting = + Id::fromSetting(ICore::settings()->value(QLatin1String(Constants::SETTINGS_THEME), + QLatin1String(Constants::DEFAULT_THEME))); + + const QList<ThemeEntry> themes = availableThemes(); + if (themes.empty()) + return Id(); + const bool settingValid = Utils::contains(themes, Utils::equal(&ThemeEntry::id, setting)); + + return settingValid ? setting : themes.first().id(); } Theme *ThemeEntry::createTheme(Id id) |