From e4823ea6fe4fa7a89c2dd6da59e091e29ba5a6f0 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Sun, 10 May 2020 11:25:49 -0400 Subject: [PATCH] cmd/uninstall: fix Array comparison In #7526 a comparison for `paths` was introduced, but if `paths` is ever `nil`, this triggers an error. Coercing the variable to an Array should alleviate this problem, as `nil.to_a` produces an empty and comparable Array. Fixes #7540 Signed-off-by: Mike Fiedler --- Library/Homebrew/cmd/uninstall.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb index c5fa22ea1..e679377d4 100644 --- a/Library/Homebrew/cmd/uninstall.rb +++ b/Library/Homebrew/cmd/uninstall.rb @@ -92,7 +92,7 @@ module Homebrew end unversioned_name = f.name.gsub(/@.+$/, "") - maybe_paths = Dir.glob("#{f.etc}/*#{unversioned_name}*") - paths + maybe_paths = Dir.glob("#{f.etc}/*#{unversioned_name}*") - paths.to_a if maybe_paths.present? puts opoo <<~EOS