CPlusPlus: Fix crash in FindUsages

Amends 45dd074441.

Change-Id: I6d32bfe4798eca4fa5cb7786cd72e4f9e109a1b7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-10-01 07:04:35 +02:00
parent 30997838e7
commit 2da4d9ae1f

View File

@@ -148,7 +148,7 @@ void FindUsages::reportResult(unsigned tokenIndex, const QList<LookupItem> &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)) {