Don't allocate TLS storage when checking to see if an exception has been thrown

llvm-svn: 147492
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 3e417e7a5cd87161016629f9bb089f4a419a5295
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
index 9d9d764..1887c5a 100644
--- a/src/cxa_exception.cpp
+++ b/src/cxa_exception.cpp
@@ -387,6 +387,8 @@
 {
 //  get the current exception
     __cxa_eh_globals* globals = __cxa_get_globals();
+    if (NULL == globals)
+        return NULL;        //  Never has been an exception
     __cxa_exception* current_exception = globals->caughtExceptions;
     if (NULL == current_exception)
         return NULL;        //  No current exception