Statistics: Don't blow up when annotating/highlighting stuff with the plugin loaded, but disabled (#6829)

Re #6825
Re #6827
reviewable/pr6837/r1
NiLuJe 4 years ago committed by GitHub
parent 40b4ccffa8
commit 982702fdc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2221,20 +2221,24 @@ function ReaderStatistics:onCloseDocument()
end
function ReaderStatistics:onAddHighlight()
if self.is_enabled then
self.data.highlights = self.data.highlights + 1
return true
end
end
function ReaderStatistics:onDelHighlight()
if self.is_enabled then
if self.data.highlights > 0 then
self.data.highlights = self.data.highlights - 1
end
return true
end
end
function ReaderStatistics:onAddNote()
if self.is_enabled then
self.data.notes = self.data.notes + 1
end
end
-- Triggered by auto_save_settings_interval_minutes
function ReaderStatistics:onSaveSettings()

Loading…
Cancel
Save