From 6a74a3c4c6bf0af2297a32ec659fc2311f7e5126 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Thu, 29 Feb 2024 19:06:02 +0200 Subject: [PATCH] androiddeployqt: fix QDirIterator::next() usage The code inside the loop body uses it.next() twice, however hasNext() is called only once; each call to next() advances the iterator. Amends 4041610cb202699a47268975e5aaecaa1f182c0a. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: Idb96cfbddc56e0d7ed38ab1b0279f40592c75175 Reviewed-by: Assam Boudjelthia (cherry picked from commit 56e151663ebfd4fc0876d33f22c81f0218339914) Reviewed-by: Qt Cherry-pick Bot --- src/tools/androiddeployqt/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 7ff699b3c69..67193ac19cd 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -2727,8 +2727,9 @@ void checkAndWarnGradleLongPaths(const QString &outputDirectory) QDirIterator it(outputDirectory, QStringList(QStringLiteral("*.java")), QDir::Files, QDirIterator::Subdirectories); while (it.hasNext()) { - if (it.next().size() >= MAX_PATH) - longFileNames.append(it.next()); + const QString &filePath = it.next(); + if (filePath.size() >= MAX_PATH) + longFileNames.append(filePath); } if (!longFileNames.isEmpty()) {