Skip to content

Commit

Permalink
Merge pull request #3939 from uklotzde/skinloader
Browse files Browse the repository at this point in the history
Fix warning when no skin configured
  • Loading branch information
daschuer authored Jun 4, 2021
2 parents 6bf67ca + a817d55 commit 69d4387
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/skin/skinloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,29 @@ SkinPointer SkinLoader::getConfiguredSkin() const {
}
}

// Pick default skin otherwise
if (configSkin.isEmpty()) {
configSkin = getDefaultSkinName();
}

// Try to load the desired skin
DEBUG_ASSERT(!configSkin.isEmpty());
SkinPointer pSkin = getSkin(configSkin);
if (pSkin && pSkin->isValid()) {
qInfo() << "Loaded skin" << configSkin;
return pSkin;
}
qWarning() << "Failed to load skin" << configSkin;

if (pSkin == nullptr || !pSkin->isValid()) {
const QString defaultSkinName = getDefaultSkinName();
pSkin = getSkin(defaultSkinName);
qWarning() << "Configured skin" << configSkin
<< "not found, falling back to default skin"
<< defaultSkinName;
// Fallback to default skin as last resort
const QString defaultSkinName = getDefaultSkinName();
DEBUG_ASSERT(!defaultSkinName.isEmpty());
pSkin = getSkin(defaultSkinName);
VERIFY_OR_DEBUG_ASSERT(pSkin && pSkin->isValid()) {
qWarning() << "Failed to load default skin" << defaultSkinName;
return nullptr;
}
qInfo() << "Loaded default skin" << defaultSkinName;
return pSkin;
}

Expand Down

0 comments on commit 69d4387

Please sign in to comment.