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