aports/testing/luacov/reporter_fix.lua.patch
2023-06-08 21:43:40 +00:00

22 lines
950 B
Diff

diff --git a/src/luacov/reporter.lua b/src/luacov/reporter.lua
index 0aadce1..d041d10 100644
--- a/src/luacov/reporter.lua
+++ b/src/luacov/reporter.lua
@@ -33,7 +33,7 @@ local function dirtree(dir)
entry=directory..dir_sep..entry
local attr=lfs.attributes(entry)
coroutine.yield(entry,attr)
- if attr.mode == "directory" then
+ if attr and attr.mode == "directory" then
yieldtree(entry)
end
end
@@ -130,7 +130,7 @@ function ReporterBase:new(conf)
local function add_empty_dir_coverage_data(directory_path)
for filename, attr in dirtree(directory_path) do
- if attr.mode == "file" and fileMatches(filename, '.%.lua$') then
+ if attr and attr.mode == "file" and fileMatches(filename, '.%.lua$') then
add_empty_file_coverage_data(filename)
end
end