[Libreoffice-commits] core.git: compilerplugins/clang

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Mar 5 11:44:50 UTC 2016


 compilerplugins/clang/cppunitassertequals.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit a3d8833bd8392ee274ced8d5b1a6e91f9b17deff
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Mar 5 05:31:04 2016 +0100

    fix crash in cppunitassertequals plugin
    
    Change-Id: I0427c70aa3a7f55aba4bbe0fe571aab08596541a
    Reviewed-on: https://gerrit.libreoffice.org/22922
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/compilerplugins/clang/cppunitassertequals.cxx b/compilerplugins/clang/cppunitassertequals.cxx
index 907f203..f5db384 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<UnaryOperator>(parent)) {
+    if (!parent || !isa<UnaryOperator>(parent)) {
         return;
     }
     parent = parentStmt(parent);
-    if (!isa<CallExpr>(parent)) {
+    if (!parent || !isa<CallExpr>(parent)) {
         return;
     }
     const CallExpr* callExpr = dyn_cast<CallExpr>(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(


More information about the Libreoffice-commits mailing list