From 2da4d9ae1ffd521b633a4b4d4fc1275f5da85f66 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 1 Oct 2020 07:04:35 +0200 Subject: [PATCH] CPlusPlus: Fix crash in FindUsages Amends 45dd074441. Change-Id: I6d32bfe4798eca4fa5cb7786cd72e4f9e109a1b7 Reviewed-by: Christian Stenger --- src/libs/cplusplus/FindUsages.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp index 773d70aa4a4..bdd1381f379 100644 --- a/src/libs/cplusplus/FindUsages.cpp +++ b/src/libs/cplusplus/FindUsages.cpp @@ -148,7 +148,7 @@ void FindUsages::reportResult(unsigned tokenIndex, const QList &cand Usage::Type FindUsages::getType(int line, int column, int tokenIndex) { const auto containsToken = [tokenIndex](const AST *ast) { - return ast->firstToken() <= tokenIndex && ast->lastToken() > tokenIndex; + return ast && ast->firstToken() <= tokenIndex && ast->lastToken() > tokenIndex; }; const auto isAssignment = [this](int token) { switch (tokenKind(token)) {