diff --git a/listframes.lua b/listframes.lua index caef743..58b183b 100644 --- a/listframes.lua +++ b/listframes.lua @@ -143,11 +143,13 @@ local function updatePage(scrollPos) end local function estimatedHeight() + local firstEntryFrame = subFrames[1] local lastEntryFrame = subFrames[length] - if lastEntryFrame ~= nil then + if firstEntryFrame ~= nil and lastEntryFrame ~= nil then + local firstXPos, firstYPos = firstEntryFrame.getPosition() local xPos, yPos = lastEntryFrame.getPosition() local xSize, ySize = lastEntryFrame.getSize() - return yPos+ySize-1 + return yPos-firstYPos+ySize else return length end