Add null check for thread name creation

Previously we didn't check for null which could result in check jni
failures if we tried to throw another OOM in the next allocation.

Bug: 18297817
Change-Id: I459b1de7760a4009e410fdbdcacdb748d13fbc1d
diff --git a/runtime/thread.cc b/runtime/thread.cc
index d231525..129c311 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -429,6 +429,10 @@
     thread_group = runtime->GetMainThreadGroup();
   }
   ScopedLocalRef<jobject> thread_name(env, env->NewStringUTF(name));
+  if (thread_name.get() == nullptr) {
+    CHECK(IsExceptionPending());
+    return;
+  }
   jint thread_priority = GetNativePriority();
   jboolean thread_is_daemon = as_daemon;