Browse Source

Fixed Thread:start(func) crashing instead of erroring

Alex Szpakowski 12 years ago
parent
commit
5b28b34a0b
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/modules/thread/wrap_LuaThread.cpp

+ 9 - 0
src/modules/thread/wrap_LuaThread.cpp

@@ -40,7 +40,16 @@ int w_Thread_start(lua_State *L)
 	{
 		args = new Variant*[nargs];
 		for (int i = 0; i < nargs; ++i)
+		{
 			args[i] = Variant::fromLua(L, i+2);
+			if (!args[i])
+			{
+				for (int j = i; j >= 0; j--)
+					delete args[j];
+				delete args;
+				return luaL_argerror(L, i+2, "boolean, number, string, love type, or flat table expected");
+			}
+		}
 	}
 
 	luax_pushboolean(L, t->start(args, nargs));