diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-05-21 01:12:23 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-05-21 01:17:52 (GMT) |
commit | 58e154ec33ec1b1aea70fa35a1c5c692fe035df2 (patch) | |
tree | 91afa6e0615e1b80861968f68d8701eaa0caeb22 /src/declarative/util | |
parent | 7e1f42ea22e34e5c846f518265c1ea864746587e (diff) | |
download | Qt-58e154ec33ec1b1aea70fa35a1c5c692fe035df2.zip Qt-58e154ec33ec1b1aea70fa35a1c5c692fe035df2.tar.gz Qt-58e154ec33ec1b1aea70fa35a1c5c692fe035df2.tar.bz2 |
Print warnings for xml query syntax errors
Task-number: QTBUG-10797
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 4d91acc..062e30e 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -128,7 +128,6 @@ struct XmlQueryJob QStringList keyRoleResultsCache; }; - class QDeclarativeXmlQuery : public QThread { Q_OBJECT @@ -355,12 +354,16 @@ void QDeclarativeXmlQuery::doSubQueryJob() QList<QVariant> resultList; if (!queries[i].isEmpty()) { subquery.setQuery(m_prefix + QLatin1String("(let $v := ") + queries[i] + QLatin1String(" return if ($v) then ") + queries[i] + QLatin1String(" else \"\")")); - QXmlResultItems resultItems; - subquery.evaluateTo(&resultItems); - QXmlItem item(resultItems.next()); - while (!item.isNull()) { - resultList << item.toAtomicValue(); //### we used to trim strings - item = resultItems.next(); + if (subquery.isValid()) { + QXmlResultItems resultItems; + subquery.evaluateTo(&resultItems); + QXmlItem item(resultItems.next()); + while (!item.isNull()) { + resultList << item.toAtomicValue(); //### we used to trim strings + item = resultItems.next(); + } + } else { + qWarning().nospace() << "XmlListModel: invalid query: " << queries[i]; } } //### should warn here if things have gone wrong. |