diff --git a/src/plugins/qmljseditor/qmlcodecompletion.cpp b/src/plugins/qmljseditor/qmlcodecompletion.cpp index 005ea17cc36af45e78c0419f9b90f6fffa4c8173..8cce3c3c4d6bf80d0f74c22fc68b07267c5b6d2a 100644 --- a/src/plugins/qmljseditor/qmlcodecompletion.cpp +++ b/src/plugins/qmljseditor/qmlcodecompletion.cpp @@ -895,7 +895,7 @@ void QmlCodeCompletion::updateSnippets() QFile file(qmlsnippets); file.open(QIODevice::ReadOnly); QXmlStreamReader xml(&file); - while (!xml.atEnd() && xml.readNextStartElement()) { + if (xml.readNextStartElement()) { if (xml.name() == QLatin1String("snippets")) { while (xml.readNextStartElement()) { if (xml.name() == QLatin1String("snippet")) { @@ -919,7 +919,6 @@ void QmlCodeCompletion::updateSnippets() item.icon = icon; m_snippets.append(item); break; - } if (xml.isCharacters()) @@ -933,14 +932,17 @@ void QmlCodeCompletion::updateSnippets() data += QChar::ObjectReplacementCharacter; } } - } + } else { + xml.skipCurrentElement(); } } + } else { + xml.skipCurrentElement(); } } if (xml.hasError()) - qWarning() << qmlsnippets << xml.errorString(); + qWarning() << qmlsnippets << xml.errorString() << xml.lineNumber() << xml.columnNumber(); file.close(); }