CppTools: Add missing null pointer check

Prevents a crash trying to look for decl/def matches in non-applicable
locations.

Fixes: QTCREATORBUG-25806
Change-Id: I70961109267a2955bef0434a92f1d913b8c0c9c1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-06-02 16:24:33 +02:00
parent 58d03f3f2f
commit b9c9c37a51

View File

@@ -436,6 +436,9 @@ QList<Declaration *> SymbolFinder::findMatchingDeclaration(const LookupContext &
Function *functionType) Function *functionType)
{ {
QList<Declaration *> result; QList<Declaration *> result;
if (!functionType)
return result;
QList<Declaration *> nameMatch, argumentCountMatch, typeMatch; QList<Declaration *> nameMatch, argumentCountMatch, typeMatch;
findMatchingDeclaration(context, functionType, &typeMatch, &argumentCountMatch, &nameMatch); findMatchingDeclaration(context, functionType, &typeMatch, &argumentCountMatch, &nameMatch);
result.append(typeMatch); result.append(typeMatch);