Fixed CID 1037101 Dereference after null check in ExecutionPath::checkScope.

This commit is contained in:
orbitcowboy 2014-05-23 18:27:34 +02:00
parent 85496cfadc
commit 7920afdc60
1 changed files with 2 additions and 2 deletions

View File

@ -364,13 +364,13 @@ void ExecutionPath::checkScope(const Token *tok, std::list<ExecutionPath *> &che
} }
// ; { ... } // ; { ... }
if (Token::Match(tok->previous(), "[;{}:] {")) { if (tok && Token::Match(tok->previous(), "[;{}:] {")) {
ExecutionPath::checkScope(tok->next(), checks); ExecutionPath::checkScope(tok->next(), checks);
tok = tok->link(); tok = tok->link();
continue; continue;
} }
if (tok->str() == "if" && tok->next() && tok->next()->str() == "(") { if (tok && tok->str() == "if" && tok->next() && tok->next()->str() == "(") {
// what variable ids should the numberOfIf be counted for? // what variable ids should the numberOfIf be counted for?
std::set<unsigned int> countif; std::set<unsigned int> countif;