Index: runtime/vm/os_thread_android.cc |
diff --git a/runtime/vm/os_thread_android.cc b/runtime/vm/os_thread_android.cc |
index 6f7ff3435a0ed6c7fc817c05811e7d5b35bf64d1..c02fd9ab4a81b6f281a06b0b3721b7a8a82ccdc6 100644 |
--- a/runtime/vm/os_thread_android.cc |
+++ b/runtime/vm/os_thread_android.cc |
@@ -95,12 +95,14 @@ static void* ThreadStart(void* data_ptr) { |
delete data; |
// Create new OSThread object and set as TLS for new thread. |
- OSThread* thread = new OSThread(); |
- OSThread::SetCurrent(thread); |
- thread->set_name(name); |
+ OSThread* thread = OSThread::CreateOSThread(); |
+ if (thread != NULL) { |
+ OSThread::SetCurrent(thread); |
+ thread->set_name(name); |
- // Call the supplied thread start function handing it its parameters. |
- function(parameter); |
+ // Call the supplied thread start function handing it its parameters. |
+ function(parameter); |
+ } |
return NULL; |
} |