summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2018-09-08 10:09:48 +0000
committerColby Swandale <me@colby.fyi>2018-09-14 22:26:18 +1000
commit696724e759da8ed7d0b1884a2d9dac84e073e0d2 (patch)
tree31764d265ae901d512819402c5c94b9756c46f93
parent90fc0ced3648717b06329458d73b9e9ef84a51c2 (diff)
downloadbundler-696724e759da8ed7d0b1884a2d9dac84e073e0d2.tar.gz
Auto merge of #6688 - voxik:check-search, r=colby-swandale
Check if 'search' is initialized. The search was checked previously, so maybe it should be checked also at this place. This issue was identified by Coverity scanner: ~~~ Error: FORWARD_NULL (CWE-476): rubygem-bundler-1.16.1/usr/share/gems/gems/bundler-1.16.1/lib/bundler/lazy_specification.rb:77: null_check: Comparing "search" to a null-like value implies that "search" might be null-like. rubygem-bundler-1.16.1/usr/share/gems/gems/bundler-1.16.1/lib/bundler/lazy_specification.rb:83: property_access: Accessing a property of null-like value "search". # 81| search = source.specs.search(self).last # 82| end # 83|-> search.dependencies = dependencies if search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification) # 84| search # 85| end ~~~ (cherry picked from commit 0aa5ea78c0d6cc1b843aeab603182c0d301203f2)
-rw-r--r--lib/bundler/lazy_specification.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index 993952c23b..d9cb01f810 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -80,7 +80,7 @@ module Bundler
"To use the platform-specific version of the gem, run `bundle config specific_platform true` and install again."
search = source.specs.search(self).last
end
- search.dependencies = dependencies if search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification)
+ search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
search
end
end