summaryrefslogtreecommitdiff
path: root/src/cat/LegacyLuaAPI.cpp
diff options
context:
space:
mode:
authormniip <mniip@mniip.com>2013-04-26 22:20:06 (GMT)
committer mniip <mniip@mniip.com>2013-04-26 22:20:06 (GMT)
commit77e837c77528965d3c98e722a55f62b45dc67cfe (patch)
tree367601f02fd512d7ee2bf9e070112c5af2ceb8bd /src/cat/LegacyLuaAPI.cpp
parenta1cdef4c901b7e115a2c883594f28f80f7bb1ab0 (diff)
downloadpowder-77e837c77528965d3c98e722a55f62b45dc67cfe.zip
powder-77e837c77528965d3c98e722a55f62b45dc67cfe.tar.gz
Fixed graphics function crash when unable to catch errors
Diffstat (limited to 'src/cat/LegacyLuaAPI.cpp')
-rw-r--r--src/cat/LegacyLuaAPI.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/cat/LegacyLuaAPI.cpp b/src/cat/LegacyLuaAPI.cpp
index a04c3bc..96b8958 100644
--- a/src/cat/LegacyLuaAPI.cpp
+++ b/src/cat/LegacyLuaAPI.cpp
@@ -775,20 +775,24 @@ 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());
-
- 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);
- *colr = luaL_optint(luacon_ci->l, -7, *colr);
- *colg = luaL_optint(luacon_ci->l, -6, *colg);
- *colb = luaL_optint(luacon_ci->l, -5, *colb);
- *firea = luaL_optint(luacon_ci->l, -4, *firea);
- *firer = luaL_optint(luacon_ci->l, -3, *firer);
- *fireg = luaL_optint(luacon_ci->l, -2, *fireg);
- *fireb = luaL_optint(luacon_ci->l, -1, *fireb);
- lua_pop(luacon_ci->l, 10);
-
+ {
+ 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);
+ *colr = luaL_optint(luacon_ci->l, -7, *colr);
+ *colg = luaL_optint(luacon_ci->l, -6, *colg);
+ *colb = luaL_optint(luacon_ci->l, -5, *colb);
+ *firea = luaL_optint(luacon_ci->l, -4, *firea);
+ *firer = luaL_optint(luacon_ci->l, -3, *firer);
+ *fireg = luaL_optint(luacon_ci->l, -2, *fireg);
+ *fireb = luaL_optint(luacon_ci->l, -1, *fireb);
+ lua_pop(luacon_ci->l, 10);
+ }
return cache;
}