cli/named_args: handle missing cask tap.

Casks (and indeed formulae) don't always have taps.

Fixes #8535
This commit is contained in:
Mike McQuaid 2020-09-01 08:50:08 +01:00
parent f260b6e7b9
commit 344d8432d2

View File

@ -180,8 +180,9 @@ module Homebrew
def warn_if_cask_conflicts(ref, loaded_type)
cask = Cask::CaskLoader.load ref
opoo "Treating #{ref} as a #{loaded_type}. For the cask, use #{cask.tap.name}/#{cask.token}"
message = "Treating #{ref} as a #{loaded_type}."
message += " For the cask, use #{cask.tap.name}/#{cask.token}" if cask.tap.present?
opoo message.freeze
rescue Cask::CaskUnavailableError
# No ref conflict with a cask, do nothing
end