From fc493458d396e03aac3444bf1a70d3a1bb96e5d0 Mon Sep 17 00:00:00 2001 From: wangfei Date: Fri, 10 May 2024 15:14:10 +0800 Subject: [PATCH] fix: crashed when launching a application contains "%U" add the condition when the index = -1 Issue: https://github.com/linuxdeepin/developer-center/issues/7964 --- src/dbus/applicationservice.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dbus/applicationservice.cpp b/src/dbus/applicationservice.cpp index 381e26f..9cc2107 100644 --- a/src/dbus/applicationservice.cpp +++ b/src/dbus/applicationservice.cpp @@ -944,6 +944,10 @@ LaunchTask ApplicationService::unescapeExec(const QString &str, const QStringLis auto filesCode = list.first().back().toLatin1(); auto codeStr = QString(R"(%%1)").arg(filesCode); auto location = execList.indexOf(codeStr); + if (location == -1) { + qWarning() << "invalid exec format, all filed code will be ignored."; + return {}; + } switch (filesCode) { case 'f': { // Defer to async job