diff options
author | Martin Smith <martin.smith@qt.io> | 2019-01-22 13:37:29 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-01-29 15:39:39 +0000 |
commit | 03a4cbc587d5009f5a2baa6c6db6bbd5ccada9cf (patch) | |
tree | 6835f5872a966200155615891fbc1670da4655be /src/qdoc/cppcodeparser.cpp | |
parent | 6ef3752a7a13b29a20b20c98cf6845f02f24c9c6 (diff) | |
download | qttools-03a4cbc587d5009f5a2baa6c6db6bbd5ccada9cf.tar.gz |
Skip NULL nodes when processing meta-commands
Add a missing null-check to a loop over nodes. Tidied up handling of
the case where the node is an Aggregate, in the process.
Change-Id: Iec39efdc9565c730baa8e0118de7cef50acd84f8
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/qdoc/cppcodeparser.cpp')
-rw-r--r-- | src/qdoc/cppcodeparser.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index 0904ebc4e..c5c723adb 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -1439,17 +1439,22 @@ void CppCodeParser::processOtherMetaCommands(NodeList &nodes, DocList& docs) NodeList::Iterator n = nodes.begin(); QList<Doc>::Iterator d = docs.begin(); while (n != nodes.end()) { - processOtherMetaCommands(*d, *n); - (*n)->setDoc(*d); - checkModuleInclusion(*n); - if ((*n)->isAggregate() && ((Aggregate *)*n)->includes().isEmpty()) { - Aggregate *m = static_cast<Aggregate *>(*n); - while (m->parent() && m->physicalModuleName().isEmpty()) - m = m->parent(); - if (m == *n) - ((Aggregate *)*n)->addInclude((*n)->name()); - else - ((Aggregate *)*n)->setIncludes(m->includes()); + if (*n != nullptr) { + processOtherMetaCommands(*d, *n); + (*n)->setDoc(*d); + checkModuleInclusion(*n); + if ((*n)->isAggregate()) { + Aggregate *aggregate = static_cast<Aggregate *>(*n); + if (aggregate->includes().isEmpty()) { + Aggregate *parent = aggregate; + while (parent->physicalModuleName().isEmpty() && (parent->parent() != nullptr)) + parent = parent->parent(); + if (parent == aggregate) + aggregate->addInclude(aggregate->name()); + else + aggregate->setIncludes(parent->includes()); + } + } } ++d; ++n; |