mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
A crash will be triggered in evernote plugin if a history file is empty (#2604)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
local DocumentRegistry = require("document/documentregistry")
|
||||
local DocSettings = require("docsettings")
|
||||
local ReadHistory = require("readhistory")
|
||||
local logger = require("logger")
|
||||
local md5 = require("ffi/MD5")
|
||||
local util = require("util")
|
||||
|
||||
@@ -263,7 +264,16 @@ function MyClipping:parseHistoryFile(clippings, history_file, doc_file)
|
||||
end
|
||||
if lfs.attributes(doc_file, "mode") ~= "file" then return end
|
||||
local ok, stored = pcall(dofile, history_file)
|
||||
if ok and stored.highlight then
|
||||
if ok then
|
||||
if not stored then
|
||||
logger.warn("An empty history file ",
|
||||
history_file,
|
||||
"has been found. The book associated is ",
|
||||
doc_file)
|
||||
return
|
||||
elseif not stored.highlight then
|
||||
return
|
||||
end
|
||||
local _, docname = util.splitFilePathName(doc_file)
|
||||
local title, author = self:getTitle(util.splitFileNameSuffix(docname))
|
||||
clippings[title] = {
|
||||
|
||||
Reference in New Issue
Block a user