Safe access to tap attributes

Prevent calling name tap attribute when the tap is nil

Co-Authored-By: Rylan Polster <rslpolster@gmail.com>
This commit is contained in:
Carlos Álvaro 2021-02-07 19:00:07 +01:00
parent 7ca79553f0
commit aebf4c9100
No known key found for this signature in database
GPG Key ID: AFEB19BC24ACCFE5
2 changed files with 3 additions and 3 deletions

View File

@ -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,

View File

@ -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),