From: Olivier Goffart Date: Fri, 25 Oct 2019 12:14:47 +0000 (+0200) Subject: Updater: Fix crash when there is an XML error X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~46^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a7f010c3700b09cbc1d1a7ec9109ebb731c55723;p=nextcloud-desktop.git Updater: Fix crash when there is an XML error The problem was accessing the lines with an off by one error, while printing the log. Other problem included the fact that QDebug added spaces, quotes, and other things which made the error lot look right in the console. Issue #7545 --- diff --git a/src/gui/updater/updateinfo.cpp b/src/gui/updater/updateinfo.cpp index 3b2d5b602..176df1ec2 100644 --- a/src/gui/updater/updateinfo.cpp +++ b/src/gui/updater/updateinfo.cpp @@ -88,9 +88,9 @@ UpdateInfo UpdateInfo::parseString(const QString &xml, bool *ok) int errorLine = 0, errorCol = 0; QDomDocument doc; if (!doc.setContent(xml, false, &errorMsg, &errorLine, &errorCol)) { - qCCritical(lcUpdater) << errorMsg << " at " << errorLine << "," << errorCol; - qCCritical(lcUpdater()) << "->" << xml.splitRef("\n")[errorLine] << "<-\n" - << QStringLiteral(" ").repeated(2 + errorCol - 1) << "^\n" + qCCritical(lcUpdater).noquote().nospace() << errorMsg << " at " << errorLine << "," << errorCol + << "\n" << xml.splitRef("\n").value(errorLine-1) << "\n" + << QString(" ").repeated(errorCol - 1) << "^\n" << "->" << xml << "<-"; if (ok) *ok = false;