summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2018-03-16 12:25:41 +0000
committerThe Bundler Bot <bot@bundler.io>2018-03-16 12:25:41 +0000
commit7f4c1a81b7b92e234fce0e3592d27c396d2451ac (patch)
treed1eb7da5b7a0df2e819ed5557d852325d611926c /lib
parentb7b847fe734dc8d95782d2e6510c8bc9a6631374 (diff)
parente24e8be8c749b16ffe8ac9548651e50024429954 (diff)
downloadbundler-7f4c1a81b7b92e234fce0e3592d27c396d2451ac.tar.gz
Auto merge of #6343 - nesaulov:fix-nil-backtrace, r=colby-swandale
Fix failure when exception backtrace is nil Resolves #6342 ### What was the end-user problem that led to this PR? Instead of throwing a readable error, Bundler failed and generated an issue report template (see details in #6342). ### What was your diagnosis of the problem? My diagnosis was that nil safety is hard in Ruby. ### What is your fix for the problem, implemented in this PR? To check whether backtrace is nil before sending it a `take_while` method. ### Why did you choose this fix out of the possible options? I chose this fix because I see no other solutions.
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli/exec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb
index d6ac453676..386565c575 100644
--- a/lib/bundler/cli/exec.rb
+++ b/lib/bundler/cli/exec.rb
@@ -77,7 +77,7 @@ module Bundler
rescue Exception => e # rubocop:disable Lint/RescueException
Bundler.ui = ui
Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
- backtrace = e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) }
+ backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : []
abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
end