From fb7f1efc497c42b9a0fb78c4f50a837be29c5b4e Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sun, 28 Jan 2018 14:27:01 +0100 Subject: [PATCH] token: Fixed potential null pointer dereference. (#1062) --- lib/token.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/token.cpp b/lib/token.cpp index 912ee30fb..71e320908 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -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 { - if (!_values) + if (!_values || !settings) return nullptr; const ValueFlow::Value *ret = nullptr; std::list::const_iterator it; @@ -1481,7 +1481,7 @@ const ValueFlow::Value * Token::getInvalidValue(const Token *ftok, unsigned int break; } } - if (settings && ret) { + if (ret) { if (ret->isInconclusive() && !settings->inconclusive) return nullptr; if (ret->condition && !settings->isEnabled(Settings::WARNING))