diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp index e51c324839a..11c9e205f28 100644 --- a/src/plugins/android/androidsdkmanager.cpp +++ b/src/plugins/android/androidsdkmanager.cpp @@ -4,7 +4,6 @@ #include "androidconfigurations.h" #include "androidsdkmanager.h" #include "androidtr.h" -#include "avdmanageroutputparser.h" #include "sdkmanageroutputparser.h" #include @@ -46,18 +45,6 @@ static const QRegularExpression &assertionRegExp() return theRegExp; } -static std::optional onLicenseStdOut(const QString &output, QString *licenseTextCache) -{ - licenseTextCache->append(output); - const QRegularExpressionMatch assertionMatch = assertionRegExp().match(*licenseTextCache); - if (assertionMatch.hasMatch()) { - const QString ret = *licenseTextCache; - licenseTextCache->clear(); - return ret; - } - return {}; -} - int parseProgress(const QString &out, bool &foundAssertion) { int progress = -1; @@ -540,12 +527,16 @@ void AndroidSdkManagerPrivate::getPendingLicense(SdkCmdPromise &fi) QString licenseTextCache; while (!licenseCommand.waitForFinished(200ms)) { const QString stdOut = codec->toUnicode(licenseCommand.readAllRawStandardOutput()); - std::optional assertion; + bool assertion = false; if (!stdOut.isEmpty()) { - assertion = onLicenseStdOut(stdOut, &licenseTextCache); - if (assertion && reviewingLicenses) { - result.stdOutput = *assertion; - fi.addResult(result); + licenseTextCache.append(stdOut); + assertion = assertionRegExp().match(licenseTextCache).hasMatch(); + if (assertion) { + if (reviewingLicenses) { + result.stdOutput = licenseTextCache; + fi.addResult(result); + } + licenseTextCache.clear(); } }