CppTools: Guard against null pointer access

... when looking up definitions of variables.
Amends a0764603d0.

Fixes: QTCREATORBUG-24610
Change-Id: I79e6f69066eaa385013e722ec4793c27231ab8eb
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2020-09-11 12:19:18 +02:00
parent 3afc21052f
commit a89e3e22b9

View File

@@ -347,7 +347,7 @@ Link attemptDeclDef(const QTextCursor &cursor, Snapshot snapshot,
funcDecl = decl->postfix_declarator_list->value->asFunctionDeclarator();
if (funcDecl)
target = symbolFinder->findMatchingDefinition(funcDecl->symbol, snapshot);
else
else if (simpleDecl->symbols)
target = symbolFinder->findMatchingVarDefinition(simpleDecl->symbols->value, snapshot);
}