From a96a879b6dde486c0898ffe4b0d51524cd40d3bf Mon Sep 17 00:00:00 2001 From: Ken-Patrick Lehrmann Date: Wed, 20 May 2020 16:02:13 +0200 Subject: [PATCH] Fix crash in addons/test/test-misra.py (#2652) --- addons/test/util.py | 2 +- lib/valueflow.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/test/util.py b/addons/test/util.py index fc4c528f9..1eb1dfe98 100644 --- a/addons/test/util.py +++ b/addons/test/util.py @@ -13,7 +13,7 @@ def find_cppcheck_binary(): if os.path.exists(location): break else: - raise RuntimeError("Could not fine cppcheck binary") + raise RuntimeError("Could not find cppcheck binary") return location diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index da538408b..10261f3c6 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -3457,6 +3457,8 @@ static bool isDecayedPointer(const Token *tok) { if (!tok) return false; + if (!tok->astParent()) + return false; if (astIsPointer(tok->astParent()) && !Token::simpleMatch(tok->astParent(), "return")) return true; if (tok->astParent()->isConstOp())