From 7920afdc60aaa2c62f489e8cba217e708e17e05c Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Fri, 23 May 2014 18:27:34 +0200 Subject: [PATCH] Fixed CID 1037101 Dereference after null check in ExecutionPath::checkScope. --- lib/executionpath.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/executionpath.cpp b/lib/executionpath.cpp index c7c65667e..074fbf273 100644 --- a/lib/executionpath.cpp +++ b/lib/executionpath.cpp @@ -364,13 +364,13 @@ void ExecutionPath::checkScope(const Token *tok, std::list &che } // ; { ... } - if (Token::Match(tok->previous(), "[;{}:] {")) { + if (tok && Token::Match(tok->previous(), "[;{}:] {")) { ExecutionPath::checkScope(tok->next(), checks); tok = tok->link(); continue; } - if (tok->str() == "if" && tok->next() && tok->next()->str() == "(") { + if (tok && tok->str() == "if" && tok->next() && tok->next()->str() == "(") { // what variable ids should the numberOfIf be counted for? std::set countif;