Fix SkinDB edge case: Limit page number by pages

master
Lars Mueller 2022-01-23 12:40:56 +01:00
parent e783b9b57f
commit 3b8e787f83
1 changed files with 1 additions and 0 deletions

View File

@ -164,6 +164,7 @@ end
local function page(pagenum, per_page, on_complete)
fetch_page(pagenum, per_page, function(pages, skins)
pagenum = math.min(pagenum, pages)
local start = math.min(1 + #epidermis.skins - (pagenum - 1) * per_page, per_page + 1)
for i = start - 1, 1, -1 do
local index = i + (pagenum - 1) * per_page