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)) {