From b9c9c37a515f9dd79fa4e9e6c8c0168d76e6d5e3 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 2 Jun 2021 16:24:33 +0200 Subject: [PATCH] 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 --- src/plugins/cpptools/symbolfinder.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/cpptools/symbolfinder.cpp b/src/plugins/cpptools/symbolfinder.cpp index 0c0c1f3d15a..7147f1d1c41 100644 --- a/src/plugins/cpptools/symbolfinder.cpp +++ b/src/plugins/cpptools/symbolfinder.cpp @@ -436,6 +436,9 @@ QList SymbolFinder::findMatchingDeclaration(const LookupContext & Function *functionType) { QList result; + if (!functionType) + return result; + QList nameMatch, argumentCountMatch, typeMatch; findMatchingDeclaration(context, functionType, &typeMatch, &argumentCountMatch, &nameMatch); result.append(typeMatch);