From 5d2ca08a93d94cbdb0efc66b5913139d2d9dfa36 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Mon, 27 Aug 2018 22:37:19 +0530 Subject: [PATCH] audit: Use `fetch` with default value prevent NPE --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 69368eedb3..e2b40f643e 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -130,7 +130,7 @@ module Homebrew formula_count += 1 problem_count += fa.problems.size problem_lines = format_problem_lines(fa.problems) - corrected_problem_count = options[:style_offenses]&.count(&:corrected?) + corrected_problem_count = options.fetch(:style_offenses, []).count(&:corrected?) new_formula_problem_lines = format_problem_lines(fa.new_formula_problems) if args.display_filename? puts problem_lines.map { |s| "#{f.path}: #{s}" }