Add null check in CursorVisitor::RunVisitorWorkList() when visiting LabelDecls. Fixes <rdar://problem/9040579>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126304 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index e288295..328ea62 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1983,10 +1983,12 @@
}
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: {