Fix error when trying to insert to the end of the file from auto4lua

Originally committed to SVN as r5760.
This commit is contained in:
Thomas Goyne 2011-10-23 17:00:14 +00:00
parent d4e17dde2e
commit 1364527681
1 changed files with 6 additions and 0 deletions

View File

@ -579,6 +579,12 @@ namespace Automation4 {
luaL_argcheck(L, before > 0 && before <= (int)lines.size() + 1, 1, luaL_argcheck(L, before > 0 && before <= (int)lines.size() + 1, 1,
"Out of range line index"); "Out of range line index");
if (before == (int)lines.size() + 1) {
lua_remove(L, 1);
ObjectAppend(L);
return;
}
SeekCursorTo(before); SeekCursorTo(before);
int n = lua_gettop(L); int n = lua_gettop(L);