]> granicus.if.org Git - clang/commitdiff
Add null check in CursorVisitor::RunVisitorWorkList() when visiting LabelDecls. ...
authorTed Kremenek <kremenek@apple.com>
Wed, 23 Feb 2011 04:54:51 +0000 (04:54 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 23 Feb 2011 04:54:51 +0000 (04:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126304 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp

index e2882953c080776097de454e87c60efa78d86a7e..328ea62f3b4401e2fc93e8f50193433cf8bd26cc 100644 (file)
@@ -1983,10 +1983,12 @@ bool CursorVisitor::RunVisitorWorkList(VisitorWorkList &WL) {
       }
       case VisitorJob::LabelRefVisitKind: {
         LabelDecl *LS = cast<LabelRefVisit>(&LI)->get();
-        if (Visit(MakeCursorLabelRef(LS->getStmt(),
-                                     cast<LabelRefVisit>(&LI)->getLoc(),
-                                     TU)))
-          return true;
+        if (LabelStmt *stmt = LS->getStmt()) {
+          if (Visit(MakeCursorLabelRef(stmt, cast<LabelRefVisit>(&LI)->getLoc(),
+                                       TU))) {
+            return true;
+          }
+        }
         continue;
       }
       case VisitorJob::NestedNameSpecifierVisitKind: {