From 1364527681887284a761934e3f2a6130dc91211b Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 23 Oct 2011 17:00:14 +0000 Subject: [PATCH] Fix error when trying to insert to the end of the file from auto4lua Originally committed to SVN as r5760. --- aegisub/src/auto4_lua_assfile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aegisub/src/auto4_lua_assfile.cpp b/aegisub/src/auto4_lua_assfile.cpp index e7d74d154..97528a35e 100644 --- a/aegisub/src/auto4_lua_assfile.cpp +++ b/aegisub/src/auto4_lua_assfile.cpp @@ -579,6 +579,12 @@ namespace Automation4 { luaL_argcheck(L, before > 0 && before <= (int)lines.size() + 1, 1, "Out of range line index"); + if (before == (int)lines.size() + 1) { + lua_remove(L, 1); + ObjectAppend(L); + return; + } + SeekCursorTo(before); int n = lua_gettop(L);