From 8a7e2a0629b2edf879e2c69d387977cb5d561938 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Sat, 23 Oct 2010 18:16:20 +0200 Subject: [PATCH] Thread wrapper checks for failed thread creation. (fixes #90) --- src/modules/thread/sdl/wrap_Thread.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/thread/sdl/wrap_Thread.cpp b/src/modules/thread/sdl/wrap_Thread.cpp index bcfd6b036..b588d8a65 100644 --- a/src/modules/thread/sdl/wrap_Thread.cpp +++ b/src/modules/thread/sdl/wrap_Thread.cpp @@ -264,6 +264,8 @@ namespace sdl else data = luax_checktype(L, 2, "Data", DATA_T); Thread *t = instance->newThread(name, data); + if (!t) + return luaL_error(L, "A thread with that name already exists."); luax_newtype(L, "Thread", THREAD_THREAD_T, (void*)t); return 1; }