From 325548ca0c111223e531ebcf4bf917b38ab26a52 Mon Sep 17 00:00:00 2001 From: Alfredo Fernandes Date: Thu, 18 Jul 2024 17:15:41 -0400 Subject: [PATCH] Fix nil pathname --- lib/slather/project.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/slather/project.rb b/lib/slather/project.rb index 4f54545..a5574cc 100755 --- a/lib/slather/project.rb +++ b/lib/slather/project.rb @@ -185,7 +185,15 @@ def create_coverage_files(binary_path, path_objects) if paths_to_segments.key?(coverage_file.source_file_pathname) coverage_file.segments = paths_to_segments[coverage_file.source_file_pathname] end - !coverage_file.ignored? && coverage_file.include_file? ? coverage_file : nil + puts "--> coverage_file.source_file_pathname: #{coverage_file.source_file_pathname}" + + if coverage_file.source_file_pathname.nil? || coverage_file.source_file_pathname.empty? + puts "--> source_file_pathname is nil or empty, source: #{source}" + else + puts "--> source_file_pathname is not nil or empty" + end + + coverage_file.source_file_pathname && !coverage_file.ignored? && coverage_file.include_file? ? coverage_file : nil end.compact end private :create_coverage_files @@ -651,7 +659,7 @@ def matches_arch(binary_path) def find_source_files source_files = load_option_array("source_files") - return if source_files.nil? + return [] if source_files.nil? current_dir = Pathname("./").realpath paths = source_files.flat_map { |pattern| Dir.glob(pattern) }.uniq