qdoc: findNodeRecursive() was called with a null start node

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>
This commit is contained in:
Martin Smith 2012-04-03 10:17:16 +02:00 committed by Qt by Nokia
parent e09fc38a36
commit 98fed68347
2 changed files with 14 additions and 2 deletions

View 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) {

View 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));
}