diff --git a/language/duchain/declaration.h b/language/duchain/declaration.h --- a/language/duchain/declaration.h +++ b/language/duchain/declaration.h @@ -214,7 +214,7 @@ * that context. * The declaration has to be part of the same top-context. * - * \returns the internal context for this declaration + * \returns the internal context for this declaration or, if none exists, nullptr */ DUContext * internalContext() const; diff --git a/plugins/filetemplates/overridespage.cpp b/plugins/filetemplates/overridespage.cpp --- a/plugins/filetemplates/overridespage.cpp +++ b/plugins/filetemplates/overridespage.cpp @@ -141,11 +141,14 @@ DUChainReadLocker lock; foreach(const DeclarationPointer& baseClass, allBases) { - DUContext* context = baseClass->internalContext(); - QTreeWidgetItem* classItem = new QTreeWidgetItem(overrideTree(), QStringList() << baseClass->qualifiedIdentifier().toString()); classItem->setIcon(ClassOrFunctionColumn, DUChainUtils::iconForDeclaration(baseClass.data())); + DUContext* context = baseClass->internalContext(); + if (!context) { + continue; + } + //For this internal context get all the function declarations inside the class foreach (Declaration * childDeclaration, context->localDeclarations()) { if (AbstractFunctionDeclaration * func = dynamic_cast(childDeclaration))