]> granicus.if.org Git - clang/commitdiff
Fix '<rdar://problem/8214263> MakeCXCursor null dereference when body of block is...
authorTed Kremenek <kremenek@apple.com>
Thu, 22 Jul 2010 11:30:19 +0000 (11:30 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 22 Jul 2010 11:30:19 +0000 (11:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109097 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp

index 47c6d3ca3ffb173ba1c729ab4fc332f6addd327e..0a3d54b6cbbc98166cfff01ea62fce9be97b7a81 100644 (file)
@@ -520,7 +520,10 @@ bool CursorVisitor::VisitBlockDecl(BlockDecl *B) {
   if (Visit(B->getSignatureAsWritten()->getTypeLoc()))
     return true;
 
-  return Visit(MakeCXCursor(B->getBody(), StmtParent, TU));
+  if (Stmt *Body = B->getBody())
+    return Visit(MakeCXCursor(Body, StmtParent, TU));
+
+  return false;
 }
 
 bool CursorVisitor::VisitDeclContext(DeclContext *DC) {