From b7f9e7ed1decbdeba42309f8fd5f3388998edd80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 22 Aug 2017 12:30:43 +0200 Subject: [PATCH] negativeContainerIndex: avoid crash when AST is wrong --- lib/checkstl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index f06d225ae..370448bde 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -446,7 +446,7 @@ void CheckStl::negativeIndex() for (std::size_t ii = 0; ii < functions; ++ii) { const Scope * scope = symbolDatabase->functionScopes[ii]; for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) { - if (!Token::Match(tok, "%var% [")) + if (!Token::Match(tok, "%var% [") || WRONG_DATA(!tok->next()->astOperand2(), tok)) continue; const Variable * const var = tok->variable(); if (!var || tok == var->nameToken())