From d1f9dc087da0d3af0b1db27fc7f993d7a127559f Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 19 Dec 2021 08:09:31 +0000 Subject: [PATCH] [applets kicker] Move safety check to a more useful place The early return obviously needs to be before we use argument.at(0); Found by the code quality checker on invent --- applets/kicker/plugin/actionlist.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/applets/kicker/plugin/actionlist.cpp b/applets/kicker/plugin/actionlist.cpp index c161eda15..c595a1480 100644 --- a/applets/kicker/plugin/actionlist.cpp +++ b/applets/kicker/plugin/actionlist.cpp @@ -345,6 +345,9 @@ bool handleRecentDocumentAction(KService::Ptr service, const QString &actionId, } const QStringList argument = _argument.toStringList(); + if (argument.isEmpty()) { + return false; + } const auto resource = argument.at(0); const auto mimeType = argument.at(1); @@ -362,10 +365,6 @@ bool handleRecentDocumentAction(KService::Ptr service, const QString &actionId, } } - if (argument.isEmpty()) { - return false; - } - auto *job = new KIO::ApplicationLauncherJob(service); job->setUrls({QUrl::fromUserInput(resource)}); job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled));