Fixed #2608 ([lib/checkpostfixoperator.cpp:87]: (error) Possible null-pointer dereference: decltok)

This commit is contained in:
Jnos Maros 2011-02-24 07:37:33 +01:00 committed by Daniel Marjamäki
parent 32a49235e3
commit 39114e3482
1 changed files with 2 additions and 2 deletions

View File

@ -74,10 +74,10 @@ void CheckPostfixOperator::postfixOperator()
if (result && tok->previous()->varId())
{
const Token *decltok = Token::findmatch(_tokenizer->tokens(), "%varid%", tok->previous()->varId());
if (!Token::Match(decltok->tokAt(-1), "%type%"))
if (decltok == NULL || !Token::Match(decltok->tokAt(-1), "%type%"))
continue;
if (decltok && Token::Match(decltok->previous(), "iterator|const_iterator|reverse_iterator|const_reverse_iterator"))
if (Token::Match(decltok->previous(), "iterator|const_iterator|reverse_iterator|const_reverse_iterator"))
{
// the variable is an iterator
postfixOperatorError(tok);