Add nullptr-check for iconTheme

KIconLoader::global()->theme() might return null. Thus we need to
guard for this case (happens e.g. on build.kde.org).

This results in iconThemeMetadataPath not being set, which is fine
as that condition is handled later on.

CCMAIL: notmart@gmail.com
Reviewed-By: Bhushan Shah
This commit is contained in:
Martin Gräßlin 2016-04-05 10:01:08 +02:00
parent 8d3ec9589c
commit 035e061e13

View File

@ -180,7 +180,9 @@ bool ThemePrivate::useCache()
if (isRegularTheme) {
themeMetadataPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % themeName % QLatin1Literal("/metadata.desktop"));
const auto *iconTheme = KIconLoader::global()->theme();
iconThemeMetadataPath = iconTheme->dir() + "index.theme";
if (iconTheme) {
iconThemeMetadataPath = iconTheme->dir() + "index.theme";
}
Q_ASSERT(!themeMetadataPath.isEmpty() || themeName.isEmpty());
const QString cacheFileBase = cacheFile + QLatin1String("*.kcache");