fix: AM crashed when Launch failed

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe 2023-09-05 14:33:21 +08:00 committed by Comix
parent 897db2c85a
commit ebe218b70e

View File

@ -173,10 +173,8 @@ QDBusObjectPath ApplicationService::Launch(const QString &action, const QStringL
process.start(m_launcher, commands); process.start(m_launcher, commands);
process.waitForFinished(); process.waitForFinished();
if (auto code = process.exitCode(); code != 0) { if (auto code = process.exitCode(); code != 0) {
auto msg = QString{"Launch Application Failed"}; qWarning() << "Launch Application Failed";
qWarning() << msg; return QDBusError::Failed;
sendErrorReply(QDBusError::Failed, msg);
return {};
} }
return objectPath; return objectPath;
} }
@ -203,10 +201,8 @@ QDBusObjectPath ApplicationService::Launch(const QString &action, const QStringL
process.waitForFinished(); process.waitForFinished();
auto exitCode = process.exitCode(); auto exitCode = process.exitCode();
if (exitCode != 0) { if (exitCode != 0) {
auto msg = QString{"Launch Application Failed"}; qWarning() << "Launch Application Failed";
qWarning() << msg; return QDBusError::Failed;
sendErrorReply(QDBusError::Failed, msg);
return {};
} }
return objectPath; return objectPath;
}, },