Fixed #2608 ([lib/checkpostfixoperator.cpp:87]: (error) Possible null-pointer dereference: decltok)
This commit is contained in:
parent
32a49235e3
commit
39114e3482
|
@ -74,10 +74,10 @@ void CheckPostfixOperator::postfixOperator()
|
||||||
if (result && tok->previous()->varId())
|
if (result && tok->previous()->varId())
|
||||||
{
|
{
|
||||||
const Token *decltok = Token::findmatch(_tokenizer->tokens(), "%varid%", 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;
|
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
|
// the variable is an iterator
|
||||||
postfixOperatorError(tok);
|
postfixOperatorError(tok);
|
||||||
|
|
Loading…
Reference in New Issue