diff options
-rw-r--r-- | mono/utils/mono-threads.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c index 366f09468e9..68ec25d84b9 100644 --- a/mono/utils/mono-threads.c +++ b/mono/utils/mono-threads.c @@ -422,7 +422,7 @@ mono_threads_unregister_current_thread (MonoThreadInfo *info) MonoThreadInfo* mono_thread_info_current_unchecked (void) { - return (MonoThreadInfo*)mono_native_tls_get_value (thread_info_key); + return thread_info_key ? (MonoThreadInfo*)mono_native_tls_get_value (thread_info_key) : NULL; } @@ -578,6 +578,9 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size) res = mono_native_tls_alloc (&thread_info_key, (void *) unregister_thread); res = mono_native_tls_alloc (&thread_exited_key, (void *) thread_exited_dtor); #endif + + g_assert (thread_info_key); + g_assert (res); #ifndef HAVE_KW_THREAD |