fix: crash when desktop file has "Hidden"

xdg 自启动目录下有些desktop文件有 Hidden 字段没有 GenerateSource
导致调用为构造的app(nullptr)

Issue: https://github.com/linuxdeepin/developer-center/issues/8523
This commit is contained in:
ck 2024-05-11 10:42:50 +08:00 committed by WangFei
parent 1c74a0a284
commit b639ab054e

View File

@ -392,7 +392,9 @@ QHash<QSharedPointer<ApplicationService>, QString> ApplicationManager1Service::s
auto shouldLaunch = tmp.value(DesktopFileEntryKey, DesktopEntryHidden).value_or(DesktopEntry::Value{}); auto shouldLaunch = tmp.value(DesktopFileEntryKey, DesktopEntryHidden).value_or(DesktopEntry::Value{});
if (!shouldLaunch.isNull() and (shouldLaunch.toString().compare("true", Qt::CaseInsensitive) == 0)) { if (!shouldLaunch.isNull() and (shouldLaunch.toString().compare("true", Qt::CaseInsensitive) == 0)) {
if (app)
app->setAutostartSource({desktopFile.sourcePath(), std::move(tmp)}); app->setAutostartSource({desktopFile.sourcePath(), std::move(tmp)});
qInfo() << "shouldn't launch this autoStart item."; qInfo() << "shouldn't launch this autoStart item.";
continue; continue;
} }