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 <miketheman@gmail.com>
This commit is contained in:
Mike Fiedler
2020-05-10 11:28:42 -04:00
parent 270fd422dc
commit e4823ea6fe
+1 -1
View File
@@ -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