token: Fixed potential null pointer dereference. (#1062)

This commit is contained in:
orbitcowboy 2018-01-28 14:27:01 +01:00 committed by Daniel Marjamäki
parent 21a35de0d2
commit fb7f1efc49
1 changed files with 2 additions and 2 deletions

View File

@ -1469,7 +1469,7 @@ const ValueFlow::Value * Token::getValueGE(const MathLib::bigint val, const Sett
const ValueFlow::Value * Token::getInvalidValue(const Token *ftok, unsigned int argnr, const Settings *settings) const const ValueFlow::Value * Token::getInvalidValue(const Token *ftok, unsigned int argnr, const Settings *settings) const
{ {
if (!_values) if (!_values || !settings)
return nullptr; return nullptr;
const ValueFlow::Value *ret = nullptr; const ValueFlow::Value *ret = nullptr;
std::list<ValueFlow::Value>::const_iterator it; std::list<ValueFlow::Value>::const_iterator it;
@ -1481,7 +1481,7 @@ const ValueFlow::Value * Token::getInvalidValue(const Token *ftok, unsigned int
break; break;
} }
} }
if (settings && ret) { if (ret) {
if (ret->isInconclusive() && !settings->inconclusive) if (ret->isInconclusive() && !settings->inconclusive)
return nullptr; return nullptr;
if (ret->condition && !settings->isEnabled(Settings::WARNING)) if (ret->condition && !settings->isEnabled(Settings::WARNING))