diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index 5202fb5ab..c3ab0eda4 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -498,8 +498,10 @@ void CheckStl::erase() for (std::list::const_iterator i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i) { const Token* const tok = i->classDef; + if (!tok) + continue; - if (tok && i->type == Scope::eFor) { + if (i->type == Scope::eFor) { for (const Token *tok2 = tok->tokAt(2); tok2; tok2 = tok2->next()) { if (tok2->str() == ";") { if (Token::Match(tok2, "; %var% !=")) {