From 1cd4e2c4bba73096cec2e10f165ae0c84bf36590 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Thu, 18 Jul 2013 13:42:03 +0200 Subject: [PATCH] guard against potential segfault when used before initialization --- src/xbt/xbt_os_thread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index f435231bbe..ae4bc9b435 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -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) -- 2.20.1