Fixed Cppcheck warning about 'null pointer dereference or redundant condition'

This commit is contained in:
Daniel Marjamäki 2014-08-04 15:15:41 +02:00
parent d35ce5f0db
commit eac337b955
1 changed files with 3 additions and 1 deletions

View File

@ -498,8 +498,10 @@ void CheckStl::erase()
for (std::list<Scope>::const_iterator i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i) { for (std::list<Scope>::const_iterator i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i) {
const Token* const tok = i->classDef; 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()) { for (const Token *tok2 = tok->tokAt(2); tok2; tok2 = tok2->next()) {
if (tok2->str() == ";") { if (tok2->str() == ";") {
if (Token::Match(tok2, "; %var% !=")) { if (Token::Match(tok2, "; %var% !=")) {