fix: crashed when launching a application contains "%U"

add the condition when the index = -1

Issue: https://github.com/linuxdeepin/developer-center/issues/7964
This commit is contained in:
wangfei 2024-05-10 15:14:10 +08:00 committed by WangFei
parent c115eb9e21
commit fc493458d3

View File

@ -944,6 +944,10 @@ LaunchTask ApplicationService::unescapeExec(const QString &str, const QStringLis
auto filesCode = list.first().back().toLatin1(); auto filesCode = list.first().back().toLatin1();
auto codeStr = QString(R"(%%1)").arg(filesCode); auto codeStr = QString(R"(%%1)").arg(filesCode);
auto location = execList.indexOf(codeStr); auto location = execList.indexOf(codeStr);
if (location == -1) {
qWarning() << "invalid exec format, all filed code will be ignored.";
return {};
}
switch (filesCode) { switch (filesCode) {
case 'f': { // Defer to async job case 'f': { // Defer to async job