qdoc: findNodeRecursive() was called with a null start node
authorMartin Smith <martin.smith@nokia.com>
Tue, 3 Apr 2012 08:17:16 +0000 (10:17 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 3 Apr 2012 10:45:46 +0000 (12:45 +0200)
This occurred in several places. They have
all been corrected to start at the tree root,
when the start node passed is null.

Task nr: QTBUG-25146

Change-Id: I5d75db0626451d30e8be8de5605036ba168f2a14
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
src/tools/qdoc/cppcodeparser.cpp
src/tools/qdoc/tree.cpp

index 7dfb32b..b08c6f9 100644 (file)
@@ -1067,9 +1067,9 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
               If it wasn't a file, it should be either a class or a namespace.
              */
             QStringList newPath = arg.split("::");
-            n = tree_->findClassNode(QStringList(newPath));
+            n = tree_->findClassNode(newPath);
             if (!n)
-                n = tree_->findNamespaceNode(QStringList(newPath));
+                n = tree_->findNamespaceNode(newPath);
         }
 
         if (!n) {
index a735f02..3dfcfea 100644 (file)
@@ -2407,6 +2407,8 @@ Node* Tree::findNodeRecursive(const QStringList& path,
  */
 EnumNode* Tree::findEnumNode(const QStringList& path, Node* start)
 {
+    if (!start)
+        start = const_cast<NamespaceNode*>(root());
     return static_cast<EnumNode*>(findNodeRecursive(path, 0, start, Node::Enum, Node::NoSubType));
 }
 
@@ -2418,6 +2420,8 @@ EnumNode* Tree::findEnumNode(const QStringList& path, Node* start)
  */
 ClassNode* Tree::findClassNode(const QStringList& path, Node* start)
 {
+    if (!start)
+        start = const_cast<NamespaceNode*>(root());
     return static_cast<ClassNode*>(findNodeRecursive(path, 0, start, Node::Class, Node::NoSubType));
 }
 
@@ -2441,6 +2445,8 @@ QmlClassNode* Tree::findQmlClassNode(const QStringList& path, Node* start)
             return qcn;
     }
 
+    if (!start)
+        start = const_cast<NamespaceNode*>(root());
     return static_cast<QmlClassNode*>(findNodeRecursive(path, 0, start, Node::Fake, Node::QmlClass));
 }
 
@@ -2452,6 +2458,8 @@ QmlClassNode* Tree::findQmlClassNode(const QStringList& path, Node* start)
  */
 NamespaceNode* Tree::findNamespaceNode(const QStringList& path, Node* start)
 {
+    if (!start)
+        start = const_cast<NamespaceNode*>(root());
     return static_cast<NamespaceNode*>(findNodeRecursive(path, 0, start, Node::Namespace, Node::NoSubType));
 }
 
@@ -2463,6 +2471,8 @@ NamespaceNode* Tree::findNamespaceNode(const QStringList& path, Node* start)
  */
 FakeNode* Tree::findGroupNode(const QStringList& path, Node* start)
 {
+    if (!start)
+        start = const_cast<NamespaceNode*>(root());
     return static_cast<FakeNode*>(findNodeRecursive(path, 0, start, Node::Fake, Node::Group));
 }
 
@@ -2474,6 +2484,8 @@ FakeNode* Tree::findGroupNode(const QStringList& path, Node* start)
  */
 FakeNode* Tree::findQmlModuleNode(const QStringList& path, Node* start)
 {
+    if (!start)
+        start = const_cast<NamespaceNode*>(root());
     return static_cast<FakeNode*>(findNodeRecursive(path, 0, start, Node::Fake, Node::QmlModule));
 }