From 5237fcd2b77745cba42733a051dfc5cca5bd1204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Thu, 31 Dec 2015 09:56:16 +0200 Subject: [PATCH] Fixed|liblegacy: Potential crash --- doomsday/sdk/liblegacy/src/concurrency.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doomsday/sdk/liblegacy/src/concurrency.cpp b/doomsday/sdk/liblegacy/src/concurrency.cpp index ad0bd53e69..a1ece1e3f6 100644 --- a/doomsday/sdk/liblegacy/src/concurrency.cpp +++ b/doomsday/sdk/liblegacy/src/concurrency.cpp @@ -161,6 +161,12 @@ void Thread_SetCallback(thread_t thread, void (*terminationFunc)(systhreadexitst int Sys_WaitThread(thread_t handle, int timeoutMs, systhreadexitstatus_t *exitStatus) { + if(!handle) + { + if(exitStatus) *exitStatus = DENG_THREAD_STOPPED_NORMALLY; + return 0; + } + CallbackThread *t = reinterpret_cast(handle); assert(static_cast(t) != QThread::currentThread()); t->wait(timeoutMs);