From d1bfa1a342e050fca0764050a2760205fdbc7fb2 Mon Sep 17 00:00:00 2001 From: YeShanShan Date: Fri, 12 Jan 2024 18:26:40 +0800 Subject: [PATCH] fix: failed to fallback default icon It's maybe a bug for deepin-app-store-tool. App's icon is installed in /opt, the tool will create a link for it's icons, but the action is async, icon-theme.cache is not ready when launchpad is read. and we only ensure display an X icon when icon is invalid. Issue: https://github.com/linuxdeepin/developer-center/issues/6860 --- src/utils/iconutils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/iconutils.cpp b/src/utils/iconutils.cpp index a9bffa48..323e7647 100644 --- a/src/utils/iconutils.cpp +++ b/src/utils/iconutils.cpp @@ -64,8 +64,10 @@ bool IconUtils::getThemeIcon(QPixmap &pixmap, const QString &iconName, const int icon = DIconTheme::findQIcon(actualIconName); - if (icon.isNull()) { + // TODO why icon is not null, but it's name is empty; + if (icon.isNull() || icon.name().isEmpty()) { icon = QIcon(":/images/application-x-desktop.svg"); + qDebug() << "It's fallback to default icon for [" << actualIconName << "]."; findIcon = false; }