threads: Assert that the global state is initialized
diff --git a/src/global.c b/src/global.c
index 691f0d4..22127fa 100644
--- a/src/global.c
+++ b/src/global.c
@@ -64,6 +64,8 @@ git_global_st *git__global_state(void)
{
void *ptr;
+ assert(_tls_init);
+
if ((ptr = TlsGetValue(_tls_index)) != NULL)
return ptr;
@@ -105,6 +107,8 @@ git_global_st *git__global_state(void)
{
void *ptr;
+ assert(_tls_init);
+
if ((ptr = pthread_getspecific(_tls_key)) != NULL)
return ptr;