From a28aafcdabe737b914ccbfd34906d95756affc79 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 24 Sep 2013 07:45:41 -0700 Subject: [PATCH] Fix crash when cancelling an automation script --- aegisub/src/auto4_lua.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aegisub/src/auto4_lua.cpp b/aegisub/src/auto4_lua.cpp index eb3f3ac36..2d17060c2 100644 --- a/aegisub/src/auto4_lua.cpp +++ b/aegisub/src/auto4_lua.cpp @@ -717,10 +717,11 @@ namespace Automation4 { ps->Log("\n\nLua reported a runtime error:\n"); ps->Log(get_string_or_default(L, -1)); } - lua_pop(L, 1); + lua_pop(L, 2); failed = true; } - lua_remove(L, -nresults - 1); + else + lua_remove(L, -nresults - 1); lua_gc(L, LUA_GCCOLLECT, 0); });