mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 04:22:34 +02:00
Fixed graphics function crash when unable to catch errors
This commit is contained in:
@@ -775,8 +775,12 @@ int luacon_graphicsReplacement(GRAPHICS_FUNC_ARGS, int i)
|
|||||||
lua_pushinteger(luacon_ci->l, *colb);
|
lua_pushinteger(luacon_ci->l, *colb);
|
||||||
callret = lua_pcall(luacon_ci->l, 4, 10, 0);
|
callret = lua_pcall(luacon_ci->l, 4, 10, 0);
|
||||||
if (callret)
|
if (callret)
|
||||||
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
|
{
|
||||||
|
luacon_ci->Log(CommandInterface::LogError, luaL_optstring(luacon_ci->l, -1, ""));
|
||||||
|
lua_pop(luacon_ci->l, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cache = luaL_optint(luacon_ci->l, -10, 0);
|
cache = luaL_optint(luacon_ci->l, -10, 0);
|
||||||
*pixel_mode = luaL_optint(luacon_ci->l, -9, *pixel_mode);
|
*pixel_mode = luaL_optint(luacon_ci->l, -9, *pixel_mode);
|
||||||
*cola = luaL_optint(luacon_ci->l, -8, *cola);
|
*cola = luaL_optint(luacon_ci->l, -8, *cola);
|
||||||
@@ -788,7 +792,7 @@ int luacon_graphicsReplacement(GRAPHICS_FUNC_ARGS, int i)
|
|||||||
*fireg = luaL_optint(luacon_ci->l, -2, *fireg);
|
*fireg = luaL_optint(luacon_ci->l, -2, *fireg);
|
||||||
*fireb = luaL_optint(luacon_ci->l, -1, *fireb);
|
*fireb = luaL_optint(luacon_ci->l, -1, *fireb);
|
||||||
lua_pop(luacon_ci->l, 10);
|
lua_pop(luacon_ci->l, 10);
|
||||||
|
}
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user