Commit 93b5fabcc03e465609d0d68af13f4ab2cf1e2dfd

Vicent Marti 2012-10-01T17:59:04

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;