Re-opening an already closed tag with high index after closing some low index tag leads to an error in the index computation for the table.insert call.
For example:
I have 3 tags, A, B, C, with respective index 1, 2, 3.
I close C => It's cached index is 3 and length of the tags list is 2
I close B => length of the tags list is 1
I try to re-open C => In the set function, idx is computed from the cache list to 3, and so you try to insert a tag at index 3 in a list of length 1 which leads to an error.
I fix this by computing idx as the minimum between the cached value and the length of the tags list (plus one).
Re-opening an already closed tag with high index after closing some low index tag leads to an error in the index computation for the
table.insert
call.For example:
set
function,idx
is computed from the cache list to 3, and so you try to insert a tag at index 3 in a list of length 1 which leads to an error.I fix this by computing idx as the minimum between the cached value and the length of the tags list (plus one).