negativeContainerIndex: avoid crash when AST is wrong
This commit is contained in:
parent
2679b576c2
commit
b7f9e7ed1d
|
@ -446,7 +446,7 @@ void CheckStl::negativeIndex()
|
||||||
for (std::size_t ii = 0; ii < functions; ++ii) {
|
for (std::size_t ii = 0; ii < functions; ++ii) {
|
||||||
const Scope * scope = symbolDatabase->functionScopes[ii];
|
const Scope * scope = symbolDatabase->functionScopes[ii];
|
||||||
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
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;
|
continue;
|
||||||
const Variable * const var = tok->variable();
|
const Variable * const var = tok->variable();
|
||||||
if (!var || tok == var->nameToken())
|
if (!var || tok == var->nameToken())
|
||||||
|
|
Loading…
Reference in New Issue