mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
KeyValuePage: Handle nil/empty kvp arrays (#9705)
This commit is contained in:
@@ -291,6 +291,7 @@ local KeyValuePage = FocusManager:extend{
|
||||
}
|
||||
|
||||
function KeyValuePage:init()
|
||||
self.kv_pairs = self.kv_pairs or {}
|
||||
self.dimen = Geom:new{
|
||||
x = 0,
|
||||
y = 0,
|
||||
@@ -594,7 +595,8 @@ function KeyValuePage:_populateItems()
|
||||
local unfit_items_count -- count item that needs to move or truncate key/value, not fit 1/2 ratio
|
||||
-- first we check if no unfit item at all
|
||||
local width_ratio
|
||||
if key_widths[#key_widths] <= key_w and value_widths[#value_widths] <= value_w then
|
||||
if (#self.kv_pairs == 0) or
|
||||
(key_widths[#key_widths] <= key_w and value_widths[#value_widths] <= value_w) then
|
||||
width_ratio = 1/2
|
||||
end
|
||||
if not width_ratio then
|
||||
|
||||
Reference in New Issue
Block a user