Fix possible null pointer dereference cppcheck warning. (#1056)
This commit is contained in:
parent
61ef48bcad
commit
8ce496a127
|
@ -99,7 +99,7 @@ const Token * Tokenizer::isFunctionHead(const Token *tok, const std::string &end
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
while (tok && tok->str() == "[")
|
while (tok && tok->str() == "[")
|
||||||
tok = tok->link()->next();
|
tok = tok->link()->next();
|
||||||
return (endsWith.find(tok->str()) != std::string::npos) ? tok : nullptr;
|
return (tok && endsWith.find(tok->str()) != std::string::npos) ? tok : nullptr;
|
||||||
}
|
}
|
||||||
if (cpp && tok->str() == ")") {
|
if (cpp && tok->str() == ")") {
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
Loading…
Reference in New Issue