checkunusedvar: Check pointer against NULL before dereferencing it.

This commit is contained in:
orbitcowboy 2016-10-31 15:57:34 +01:00
parent 2c12071065
commit a81920cae1
1 changed files with 1 additions and 1 deletions

View File

@ -973,7 +973,7 @@ bool CheckUninitVar::isVariableUsage(const Token *vartok, bool pointer, Alloc al
const Token *parent = vartok->next()->astParent();
while (Token::Match(parent, "[|."))
parent = parent->astParent();
if (Token::simpleMatch(parent, "&") && !parent->astOperand2())
if (parent && Token::simpleMatch(parent, "&") && !parent->astOperand2())
return false;
if (parent && Token::Match(parent->previous(), "if|while|switch ("))
return true;