2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00

Fix crash attempting to set compact items in status bar (#7172)

This commit is contained in:
Jason Benwell 2021-01-19 15:07:56 -05:00 committed by GitHub
parent 0c76c73e4f
commit 41ab04b49e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -280,7 +280,7 @@ local footerTextGeneratorMap = {
local symbol_type = footer.settings.item_prefix or "icons"
local prefix = symbol_prefix[symbol_type].book_time_to_read
local left = footer.ui.document:getTotalPagesLeft(footer.pageno)
return footer:getDataFromStatistics(prefix .. " ", left)
return footer:getDataFromStatistics(prefix and (prefix.." ") or "", left)
end,
chapter_time_to_read = function(footer)
local symbol_type = footer.settings.item_prefix or "icons"
@ -820,7 +820,8 @@ function ReaderFooter:textOptionTitles(option)
battery = T(_("Battery status (%1)"), symbol_prefix[symbol].battery),
percentage = symbol_prefix[symbol].percentage
and T(_("Progress percentage (%1)"), symbol_prefix[symbol].percentage) or _("Progress percentage"),
book_time_to_read = T(_("Book time to read (%1)"),symbol_prefix[symbol].book_time_to_read),
book_time_to_read = symbol_prefix[symbol].book_time_to_read
and T(_("Book time to read (%1)"),symbol_prefix[symbol].book_time_to_read) or _("Book time to read"),
chapter_time_to_read = T(_("Chapter time to read (%1)"), symbol_prefix[symbol].chapter_time_to_read),
frontlight = T(_("Frontlight level (%1)"), symbol_prefix[symbol].frontlight),
mem_usage = T(_("KOReader memory usage (%1)"), symbol_prefix[symbol].mem_usage),
@ -1254,7 +1255,7 @@ function ReaderFooter:addToMainMenu(menu_items)
return T(_("Compact Items (%1)"), table.concat(sym_tbl, " "))
end,
checked_func = function()
return self.settings.item_prefix == "compact_items" or self.settings.item_prefix == nil
return self.settings.item_prefix == "compact_items"
end,
callback = function()
self.settings.item_prefix = "compact_items"