From 91fc8a00613561b4b92763ad60af13dee88a8bc8 Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Tue, 28 Mar 2023 20:04:40 +0300 Subject: [PATCH] readhistory: fix clear missing (#10257) --- frontend/readhistory.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/readhistory.lua b/frontend/readhistory.lua index 6c3ef27ad..7d9e65fbe 100644 --- a/frontend/readhistory.lua +++ b/frontend/readhistory.lua @@ -217,9 +217,10 @@ end --- Checks the history list for deleted files and removes history items respectively. function ReadHistory:clearMissing() local history_updated - for i, v in ipairs(self.hist) do - if v.file == nil or lfs.attributes(v.file, "mode") ~= "file" then - self:removeItem(v, i, true) -- no flush + for i = #self.hist, 1, -1 do + local file = self.hist[i].file + if file == nil or lfs.attributes(file, "mode") ~= "file" then + self:removeItem(self.hist[i], i, true) -- no flush history_updated = true end end