From a3d8833bd8392ee274ced8d5b1a6e91f9b17deff Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 5 Mar 2016 05:31:04 +0100 Subject: [PATCH] fix crash in cppunitassertequals plugin Change-Id: I0427c70aa3a7f55aba4bbe0fe571aab08596541a Reviewed-on: https://gerrit.libreoffice.org/22922 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- compilerplugins/clang/cppunitassertequals.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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(