From aebf4c9100ead9fca5fb3f12cc5bf037dc92e771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20=C3=81lvaro?= Date: Sun, 7 Feb 2021 19:00:07 +0100 Subject: [PATCH] Safe access to tap attributes Prevent calling name tap attribute when the tap is nil Co-Authored-By: Rylan Polster --- Library/Homebrew/cask/cask.rb | 4 ++-- Library/Homebrew/formula.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index 7598166061..2475b84da0 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -169,8 +169,8 @@ module Cask def to_h { "token" => token, - "full_token" => "#{tap.name}/#{token}", - "tap" => tap.name, + "full_token" => full_name, + "tap" => tap&.name, "name" => name, "desc" => desc, "homepage" => homepage, diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index ca2cf52183..439cb2076a 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1766,7 +1766,7 @@ class Formula hsh = { "name" => name, "full_name" => full_name, - "tap" => tap.name, + "tap" => tap&.name, "oldname" => oldname, "aliases" => aliases.sort, "versioned_formulae" => versioned_formulae.map(&:name),