History: avoid opening non-existent files

Mostly just so we don't get the History closed when
erroneously tapping on a deleted file.
pull/7322/head
poire-z 3 years ago
parent fe10d0bce5
commit d63d282806

@ -39,6 +39,9 @@ local function buildEntry(input_time, input_file)
end
return util.secondsToDate(last_read_ts, G_reader_settings:isTrue("twelve_hour_clock"))
end,
select_enabled_func = function()
return lfs.attributes(file_path, "mode") == "file"
end,
callback = function()
local ReaderUI = require("apps/reader/readerui")
ReaderUI:showReader(input_file)

@ -1173,6 +1173,14 @@ override this function to process the item selected in a different manner
]]--
function Menu:onMenuSelect(item)
if item.sub_item_table == nil then
if item.select_enabled == false then
return true
end
if item.select_enabled_func then
if not item.select_enabled_func() then
return true
end
end
if self.close_callback then
self.close_callback()
end

Loading…
Cancel
Save