diff --git a/Library/Homebrew/checksum.rb b/Library/Homebrew/checksum.rb index 506885fce3..c1d0e70551 100644 --- a/Library/Homebrew/checksum.rb +++ b/Library/Homebrew/checksum.rb @@ -13,6 +13,6 @@ class Checksum delegate [:empty?, :to_s] => :@hexdigest def ==(other) - hash_type == other.hash_type && hexdigest == other.hexdigest + hash_type == other&.hash_type && hexdigest == other.hexdigest end end diff --git a/Library/Homebrew/test/checksum_spec.rb b/Library/Homebrew/test/checksum_spec.rb index acab348b7e..01cfd29d13 100644 --- a/Library/Homebrew/test/checksum_spec.rb +++ b/Library/Homebrew/test/checksum_spec.rb @@ -15,5 +15,6 @@ describe Checksum do it { is_expected.to eq(other) } it { is_expected.not_to eq(other_reversed) } it { is_expected.not_to eq(other_sha1) } + it { is_expected.not_to eq(nil) } end end