From 3a99ce7f6d43f2bb1b35d7365d1ca476cd967626 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Mon, 23 Apr 2012 11:18:34 +0200 Subject: [PATCH] posix: don't segfault when calling ThreadsWait() without a valid thread --- src/lib/platform/posix/os-threads.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/platform/posix/os-threads.h b/src/lib/platform/posix/os-threads.h index 8b56731..89f822b 100644 --- a/src/lib/platform/posix/os-threads.h +++ b/src/lib/platform/posix/os-threads.h @@ -66,7 +66,7 @@ namespace PLATFORM typedef pthread_t thread_t; #define ThreadsCreate(thread, func, arg) (pthread_create(&thread, NULL, (void *(*) (void *))func, (void *)arg) == 0) - #define ThreadsWait(thread, retval) (pthread_join(thread, retval) == 0) + #define ThreadsWait(thread, retval) (thread ? pthread_join(thread, retval) == 0 : true) typedef pthread_mutex_t mutex_t; #define MutexCreate(mutex) pthread_mutex_init(&mutex, GetRecursiveMutexAttribute()); -- 2.34.1