diff options
author | Edward Welbourne <[email protected]> | 2025-02-11 16:42:50 +0100 |
---|---|---|
committer | Edward Welbourne <[email protected]> | 2025-02-19 18:03:45 +0100 |
commit | 82ae262de27534170060e61e8d1f4b045ae13fb8 (patch) | |
tree | e40f3baf2a607b2f7a9f35887219dce98b00d06b | |
parent | 97517b20aaaccb9f2bfa6d571a71f40560507476 (diff) |
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
Pick-to: 6.9
Coverity-Id: 474724
Coverity-Id: 474725
Coverity-Id: 474726
Change-Id: Id622a91d2e443276756e50729cf155b10f7164a1
Reviewed-by: Matthias Rauter <[email protected]>
-rw-r--r-- | src/xml/dom/qdom.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 93c0f85c7c5..9daf13f377c 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -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 |