diff options
author | Paul Wicking <[email protected]> | 2025-06-03 11:53:03 +0200 |
---|---|---|
committer | Paul Wicking <[email protected]> | 2025-06-05 06:28:48 +0000 |
commit | 54423aeadffced7db537a469474bc13f6a855234 (patch) | |
tree | bde3dec30156732d5487c355645a8d3503bee547 | |
parent | 76fac13efee68b58cd7604b804360aa18ba7d986 (diff) |
Coverity complains that `parent` can be dereferenced in the
QDocIndexFiles::readIndexSection function, and indeed it is possible to
create a situation where that happens. This change ensures that the
nullptr check applies equally to the various 'or' conditions in the if
expression.
Coverity-Id: 480819
Pick-to: 6.10 6.9 6.8
Change-Id: I8c6a9095bc837c772b9a9d699bb5dbe400eb56de
Reviewed-by: Topi Reiniƶ <[email protected]>
-rw-r--r-- | src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp index 3061cbb90..64b12c21f 100644 --- a/src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp +++ b/src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp @@ -251,8 +251,8 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current, location = Location(indexUrl + QLatin1Char('/') + name); else if (!indexUrl.isNull()) location = Location(name); - } else if (parent && (elementName == QLatin1String("qmlclass") || elementName == QLatin1String("qmlvaluetype") - || elementName == QLatin1String("qmlbasictype"))) { + } else if (parent && ((elementName == QLatin1String("qmlclass") || elementName == QLatin1String("qmlvaluetype") + || elementName == QLatin1String("qmlbasictype")))) { auto *qmlTypeNode = new QmlTypeNode(parent, name, elementName == QLatin1String("qmlclass") ? NodeType::QmlType : NodeType::QmlValueType); qmlTypeNode->setTitle(attributes.value(QLatin1String("title")).toString()); @@ -274,7 +274,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current, else if (!indexUrl.isNull()) location = Location(name); node = qmlTypeNode; - } else if (elementName == QLatin1String("qmlproperty")) { + } else if (parent && elementName == QLatin1String("qmlproperty")) { QString type = attributes.value(QLatin1String("type")).toString(); bool attached = false; if (attributes.value(QLatin1String("attached")) == QLatin1String("true")) |