Fixed two nullpointer messages in cppcheck

This commit is contained in:
PKEuS 2015-02-01 15:21:09 +01:00
parent 451a277b18
commit 9dfb864522
2 changed files with 4 additions and 2 deletions

View File

@ -635,7 +635,7 @@ bool Library::isScopeNoReturn(const Token *end, std::string *unknownFunc) const
const Token *funcname = end->linkAt(-2)->previous();
const Token *start = funcname;
if (funcname && Token::Match(funcname->tokAt(-3),"( * %name% )")) {
if (Token::Match(funcname->tokAt(-3),"( * %name% )")) {
funcname = funcname->previous();
start = funcname->tokAt(-3);
} else if (funcname->isName()) {

View File

@ -7567,9 +7567,11 @@ void Tokenizer::simplifyEnum()
//jump back once, see the comment at the end of the function
goback = false;
tok = tok->previous();
if (!tok)
break;
}
if (tok && tok->next() &&
if (tok->next() &&
(!tok->previous() || (tok->previous()->str() != "enum")) &&
Token::Match(tok, "class|struct|namespace")) {
className = tok->next()->str();