From a0d9fcfe6283518efbab19137362432b69c596b4 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sat, 22 Jun 2019 17:59:51 +0200 Subject: [PATCH] Increment iterator before any potential continue Otherwise if none of the results are viable, we could end up in an infinite loop because we continue before we actually advance the iterator but also never reach the actionCount limit. Differential Revision: https://phabricator.kde.org/D22004 --- actionlist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actionlist.cpp b/actionlist.cpp index 27b2bf4d2..6c0106190 100644 --- a/actionlist.cpp +++ b/actionlist.cpp @@ -255,6 +255,8 @@ QVariantList recentDocumentActions(KService::Ptr service) while (list.count() < 6 && resultIt != results.end()) { const QString resource = (*resultIt).resource(); + ++resultIt; + const QUrl url(resource); if (!url.isValid()) { @@ -275,8 +277,6 @@ QVariantList recentDocumentActions(KService::Ptr service) item["icon"] = fileItem.iconName(); list << item; - - ++resultIt; } if (list.count()) {