[fix] don't crash when enabling statistics on new book (#5971)

This commit is contained in:
yparitcher
2020-03-20 06:01:38 -05:00
committed by GitHub
parent 7a0fe89ab7
commit e9d0c7a96e

View File

@@ -205,6 +205,8 @@ function ReaderStatistics:initData()
self.total_read_pages, self.total_read_time = self:getPageTimeTotalStats(self.id_curr_book)
if self.total_read_pages > 0 then
self.avg_time = self.total_read_time / self.total_read_pages
else
self.avg_time = 0
end
end