From f25272298953fc91a29eb23d970087874e61b6fd Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Thu, 30 Sep 2021 14:05:48 -0700 Subject: [PATCH] Fix error in dir_rescan_add_job --- data/core/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data/core/init.lua b/data/core/init.lua index 50cbd5a4..9c6f9b4e 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -1077,8 +1077,9 @@ function core.dir_rescan_add_job(dir, filepath) if dirpath then -- check if the directory is in the project files list, if not exit local dir_index, dir_match = file_search(dir.files, {filename = dirpath, type = "dir"}) - local dir_filename = dir.files[dir_index].filename - if not dir_match or not core.project_subdir_is_shown(dir, dir_filename) then return end + -- Note that is dir_match is false dir_index greaten than the last valid index. + -- We use dir_index to index dir.files below only if dir_match is true. + if not dir_match or not core.project_subdir_is_shown(dir, dir.files[dir_index].filename) then return end end local new_time = system.get_time() + 1