Skip to content

Commit 9dcf242

Browse files
committed
Update list.lua
1 parent bff756d commit 9dcf242

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gooey/internal/list.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ local dynamic_lists = {}
99

1010
-- update the positions of the list items and set their data indices
1111
local function update_dynamic_listitem_positions(list)
12+
if list.data_size == 0 then
13+
return
14+
end
1215
local top_i, top_y, top_x
1316
if list.horizontal then
1417
top_i = list.scroll_pos.x / list.item_size.x
@@ -22,7 +25,7 @@ local function update_dynamic_listitem_positions(list)
2225
local item = list.items[i]
2326
local item_pos = gui.get_position(item.root)
2427
local index = first_index + i - 1
25-
item.index = ((index - 1) % #list.data) + 1
28+
item.index = ((index - 1) % list.data_size) + 1
2629
if list.horizontal then
2730
item_pos.x = list.first_item_pos.x - (list.item_size.x * (i - 1)) + top_x
2831
else

0 commit comments

Comments
 (0)