diff --git a/compilerplugins/clang/cppunitassertequals.cxx b/compilerplugins/clang/cppunitassertequals.cxx index 907f203d2917..f5db38421dd3 100644 --- a/compilerplugins/clang/cppunitassertequals.cxx +++ b/compilerplugins/clang/cppunitassertequals.cxx @@ -76,19 +76,19 @@ void CppunitAssertEquals::checkExpr(const Stmt* stmt) return; } parent = parentStmt(parent); - if (!isa(parent)) { + if (!parent || !isa(parent)) { return; } parent = parentStmt(parent); - if (!isa(parent)) { + if (!parent || !isa(parent)) { return; } const CallExpr* callExpr = dyn_cast(parent); - if (callExpr->getDirectCallee() == nullptr) { + if (!callExpr || callExpr->getDirectCallee() == nullptr) { return; } const FunctionDecl* functionDecl = callExpr->getDirectCallee()->getCanonicalDecl(); - if (functionDecl->getQualifiedNameAsString().find("Asserter::failIf") == std::string::npos) { + if (!functionDecl || functionDecl->getQualifiedNameAsString().find("Asserter::failIf") == std::string::npos) { return; } report(