Avoid returning null from find{Next,Prev}InOrder(non-null)
The checkNode(p) call relies on p being non-null, so CodeChecker grumbled. In any case, we should be returning node_impl if we fall off the end of the structure (which shouldn't be possible, since we descended into the three and can't come back out on the way up without passing through node_impl, for which we check). Include a null-check in checkNode(), save the nsURI.isNull() check when !p->isElement() makes it redundant and fix some coding style nits while I'm about it. Amends commit 8609982791928a30a6d836b25810143a064f8c6f Coverity-Id: 474724 Coverity-Id: 474725 Coverity-Id: 474726 Change-Id: Id622a91d2e443276756e50729cf155b10f7164a1 Reviewed-by: Matthias Rauter <matthias.rauter@qt.io> (cherry picked from commit 82ae262de27534170060e61e8d1f4b045ae13fb8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
05b91b1195
commit
320a3b1328
@ -660,13 +660,13 @@ void QDomNodeListPrivate::createList() const
|
||||
|
||||
Checks if a node is valid and fulfills the requirements set during the
|
||||
generation of this list, i.e. matching tag and matching URI.
|
||||
*/
|
||||
bool QDomNodeListPrivate::checkNode(QDomNodePrivate *p) const {
|
||||
if (nsURI.isNull())
|
||||
return p->isElement() && p->nodeName() == tagname;
|
||||
else
|
||||
return p->isElement() && p->name==tagname && p->namespaceURI==nsURI;
|
||||
};
|
||||
*/
|
||||
bool QDomNodeListPrivate::checkNode(QDomNodePrivate *p) const
|
||||
{
|
||||
return p && p->isElement() && (nsURI.isNull()
|
||||
? p->nodeName() == tagname
|
||||
: p->name == tagname && p->namespaceURI == nsURI);
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user