Skip to content

Commit 6eef1f2

Browse files
committed
Add condition to increase array size when last element is not nil
1 parent d438c4b commit 6eef1f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Lua/LuaTable.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ public void Insert(int index, LuaValue value)
149149
}
150150

151151
var arrayIndex = index - 1;
152-
153-
if (index > array.Length)
152+
153+
if (index > array.Length || array[^1].Type != LuaValueType.Nil)
154154
{
155155
EnsureArrayCapacity(array.Length + 1);
156156
}

0 commit comments

Comments
 (0)