aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-09-11 12:19:18 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-09-11 11:44:02 +0000
commita89e3e22b9058298ae881ca4cb48f2e0c573ca86 (patch)
tree1406548dd211d2ffa0633671eac37f505c56f965
parent3afc21052f29f1ee2901c9fc3596119c9348d0b4 (diff)
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>
-rw-r--r--src/plugins/cpptools/cppfollowsymbolundercursor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/cpptools/cppfollowsymbolundercursor.cpp b/src/plugins/cpptools/cppfollowsymbolundercursor.cpp
index a21babf852..9f26de16d3 100644
--- a/src/plugins/cpptools/cppfollowsymbolundercursor.cpp
+++ b/src/plugins/cpptools/cppfollowsymbolundercursor.cpp
@@ -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);
}