From 9d1b439fb7c146d9754c0893750effa03b46d6df Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 12 Mar 2017 00:25:55 +0300 Subject: tests: Allow lfs.attributes to be NULL when traversing FS --- test/helpers.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/helpers.lua b/test/helpers.lua index d3dca00385..e5224349c2 100644 --- a/test/helpers.lua +++ b/test/helpers.lua @@ -30,13 +30,15 @@ local function glob(initial_path, re, exc_re) if ((not exc_re or not checked_path:match(exc_re)) and e:sub(1, 1) ~= '.') then local attrs = lfs.attributes(full_path) - local check_key = attrs.dev .. ':' .. tostring(attrs.ino) - if not checked_files[check_key] then - checked_files[check_key] = true - if attrs.mode == 'directory' then - paths_to_check[#paths_to_check + 1] = full_path - elseif not re or checked_path:match(re) then - ret[#ret + 1] = full_path + if attrs then + local check_key = attrs.dev .. ':' .. tostring(attrs.ino) + if not checked_files[check_key] then + checked_files[check_key] = true + if attrs.mode == 'directory' then + paths_to_check[#paths_to_check + 1] = full_path + elseif not re or checked_path:match(re) then + ret[#ret + 1] = full_path + end end end end -- cgit