aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/index.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/index.rb')
-rw-r--r--lib/bundler/index.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb
index 6a20302322..1b2d3b5333 100644
--- a/lib/bundler/index.rb
+++ b/lib/bundler/index.rb
@@ -179,7 +179,8 @@ module Bundler
end
def specs_by_name(name)
- @specs[name].values
+ return EMPTY_SEARCH unless specs = @specs.fetch(name, nil)
+ specs.values
end
EMPTY_SEARCH = [].freeze
@@ -190,11 +191,13 @@ module Bundler
end
def find_by_spec(spec)
- @specs[spec.name][spec.full_name]
+ return unless specs = @specs.fetch(spec.name, nil)
+ specs[spec.full_name]
end
def exist?(spec)
- @specs[spec.name].key?(spec.full_name)
+ return unless specs = @specs.fetch(spec.name, nil)
+ specs.key?(spec.full_name)
end
end
end