diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index 0697ba7ff3..0b6801788e 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -10,6 +10,8 @@ class Dependency DEFAULT_ENV_PROC = proc {} def initialize(name, tags = [], env_proc = DEFAULT_ENV_PROC, option_names = [name]) + raise ArgumentError, "Dependency must have a name!" unless name + @name = name @tags = tags @env_proc = env_proc diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 0ab60f1cbe..c6375b46b0 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1522,7 +1522,10 @@ class Formula if read_from_tab && (keg = opt_or_installed_prefix_keg) && (tab_deps = keg.runtime_dependencies) - return tab_deps.map { |d| Dependency.new d["full_name"] }.compact + return tab_deps.map do |d| + next unless d["full_name"] + Dependency.new d["full_name"] + end.compact end declared_runtime_dependencies | undeclared_runtime_dependencies diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 508611ac80..eab57183bc 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -277,6 +277,7 @@ module Formulary # * a formula URL # * a local bottle reference def self.factory(ref, spec = :stable, alias_path: nil, from: nil) + raise ArgumentError, "Formulae must have a ref!" unless ref loader_for(ref, from: from).get_formula(spec, alias_path: alias_path) end