Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
guard against potential segfault when used before initialization
authorAugustin Degomme <degomme@idpann.imag.fr>
Thu, 18 Jul 2013 11:42:03 +0000 (13:42 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Thu, 18 Jul 2013 11:42:03 +0000 (13:42 +0200)
src/xbt/xbt_os_thread.c

index f435231..ae4bc9b 100644 (file)
@@ -1234,7 +1234,8 @@ void xbt_os_thread_set_extra_data(void *data)
 
 void *xbt_os_thread_get_extra_data(void)
 {
-  return xbt_os_thread_self()->extra_data;
+  xbt_os_thread_t self = xbt_os_thread_self();
+  return self? self->extra_data : NULL;
 }
 
 xbt_os_rmutex_t xbt_os_rmutex_init(void)