Commits

Alex Szpakowski committed 167473a

Fixed Thread:start(func) crashing instead of erroring

Comments (0)

Files changed (1)

src/modules/thread/wrap_LuaThread.cpp

 	{
 		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));