Fix a bug recovering from broken code with a goto that Eli reported.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46336 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 51d6547..a264eea 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1031,8 +1031,13 @@
       // At this point, we have gotos that use the bogus label.  Stitch it into
       // the function body so that they aren't leaked and that the AST is well
       // formed.
-      L->setSubStmt(new NullStmt(L->getIdentLoc()));
-      cast<CompoundStmt>((Stmt*)Body)->push_back(L);
+      if (Body) {
+        L->setSubStmt(new NullStmt(L->getIdentLoc()));
+        cast<CompoundStmt>((Stmt*)Body)->push_back(L);
+      } else {
+        // The whole function wasn't parsed correctly, just delete this.
+        delete L;
+      }
     }
   }
   LabelMap.clear();