A crash will be triggered in evernote plugin if a history file is empty (#2604)

pull/2607/head
Hzj_jie 7 years ago committed by Qingping Hou
parent cfe7b0f5e0
commit e974476099

@ -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] = {

Loading…
Cancel
Save