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

Noel Grandin noel at peralex.com
Mon May 16 09:25:58 UTC 2016


 compilerplugins/clang/commaoperator.cxx |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

New commits:
commit 42801672f0acc3b2ffbc30602d881b43e62d07cf
Author: Noel Grandin <noel at peralex.com>
Date:   Mon May 16 11:25:06 2016 +0200

    fix null pointer crash in loplugin:commaoperator
    
    Change-Id: Ie077ed9a8f200b39da25938b35a3622e52cc5110

diff --git a/compilerplugins/clang/commaoperator.cxx b/compilerplugins/clang/commaoperator.cxx
index 4df9cea..3e5df3d 100644
--- a/compilerplugins/clang/commaoperator.cxx
+++ b/compilerplugins/clang/commaoperator.cxx
@@ -44,20 +44,22 @@ bool CommaOperator::VisitBinaryOperator(const BinaryOperator* binaryOp)
         return true;
     }
     const Stmt* parent = parentStmt(binaryOp);
-    if (isa<ParenExpr>(parent)) {
-        return true;
-    }
-    if (isa<BinaryOperator>(parent)) {
-        return true;
-    }
-    if (isa<ForStmt>(parent)) {
-        return true;
-    }
-    if (isa<ExprWithCleanups>(parent)) {
-        const Stmt* parent2 = parentStmt(parent);
-        if (isa<ForStmt>(parent2)) {
+    if (parent != nullptr) {
+        if (isa<ParenExpr>(parent)) {
             return true;
         }
+        if (isa<BinaryOperator>(parent)) {
+            return true;
+        }
+        if (isa<ForStmt>(parent)) {
+            return true;
+        }
+        if (isa<ExprWithCleanups>(parent)) {
+            const Stmt* parent2 = parentStmt(parent);
+            if (isa<ForStmt>(parent2)) {
+                return true;
+            }
+        }
     }
 //    parent->dump();
     report(


More information about the Libreoffice-commits mailing list