SAPI: Throw runtime error instead of if l_get_mapgen_object called in incorrect thread
authorkwolekr <kwolekr@minetest.net>
Mon, 26 Oct 2015 03:12:59 +0000 (23:12 -0400)
committerkwolekr <kwolekr@minetest.net>
Mon, 26 Oct 2015 03:15:57 +0000 (23:15 -0400)
src/script/lua_api/l_mapgen.cpp

index 825292419a7968e8c8a1c6f8bf4f567a7a3495d9..7adb6a534d70d76e9de43952ff0309ebff0b6314 100644 (file)
@@ -493,7 +493,7 @@ int ModApiMapgen::l_get_mapgen_object(lua_State *L)
        EmergeManager *emerge = getServer(L)->getEmergeManager();
        Mapgen *mg = emerge->getCurrentMapgen();
        if (!mg)
-               return 0;
+               throw LuaError("Must only be called in a mapgen thread!");
 
        size_t maplen = mg->csize.X * mg->csize.Z;