Fixed Cppcheck warning about 'null pointer dereference or redundant condition'
This commit is contained in:
parent
d35ce5f0db
commit
eac337b955
|
@ -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% !=")) {
|
||||||
|
|
Loading…
Reference in New Issue