Instead of aborting in debug builds and failing silently in release
builds, print a meaningful warning message into the test output and
return a null QVariant.
Change-Id: Idcd70f5cb01528b522d84e391f6f8692a189f420
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit
a0496d1db09dfaa6a2b31a5c23e154de7b4a2eb7)
{
const Node *const internal = toInternal(ni);
- Q_ASSERT(internal->kind == QXmlNodeModelIndex::Attribute
- || internal->kind == QXmlNodeModelIndex::Element);
+ if (internal->kind != QXmlNodeModelIndex::Attribute
+ && internal->kind != QXmlNodeModelIndex::Element) {
+ qWarning("%s: node must be an attribute or element", Q_FUNC_INFO);
+ return QVariant();
+ }
return internal->value;
}