Fixed graphics function crash when unable to catch errors

This commit is contained in:
mniip
2013-04-27 02:20:06 +04:00
parent a1cdef4c90
commit 77e837c775

View File

@@ -775,8 +775,12 @@ int luacon_graphicsReplacement(GRAPHICS_FUNC_ARGS, int i)
lua_pushinteger(luacon_ci->l, *colb);
callret = lua_pcall(luacon_ci->l, 4, 10, 0);
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);
*pixel_mode = luaL_optint(luacon_ci->l, -9, *pixel_mode);
*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);
*fireb = luaL_optint(luacon_ci->l, -1, *fireb);
lua_pop(luacon_ci->l, 10);
}
return cache;
}