Skip to content

Commit

Permalink
Updater: Fix crash when there is an XML error
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ogoffart committed Oct 28, 2019
1 parent 54e374c commit 72b886f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gui/updater/updateinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ UpdateInfo UpdateInfo::parseString(const QString &xml, bool *ok)
int errorLine, errorCol;
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;
Expand Down

0 comments on commit 72b886f

Please sign in to comment.