Try to fix crash when using getMaxValue()

This commit is contained in:
Daniel Marjamäki 2015-11-07 19:59:48 +01:00
parent 32627dc558
commit 35ed902e3f
1 changed files with 1 additions and 1 deletions

View File

@ -1080,7 +1080,7 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable()
bufferOverrunError(tok, tok->str());
}
if (Token::Match(tok, "%var% [") && tok->variable() && tok->variable()->isPointer()) {
if (Token::Match(tok, "%var% [") && tok->next()->astOperand2() && tok->variable() && tok->variable()->isPointer()) {
const ValueFlow::Value *value = tok->next()->astOperand2()->getMaxValue(false);
if (!value)
continue;