Skip to content

Commit

Permalink
[rubygems/rubygems] Fix Kernel#warn override to handle backtrace loca…
Browse files Browse the repository at this point in the history
…tion with nil path

It's very unlikely to hit this case, but it is possible, as
Thread::Backtrace::Location#path can return nil if the location is
a cfunc with no previous iseq.  See location_path in vm_backtrace.c
in Ruby.

rubygems/rubygems@511935645a
  • Loading branch information
jeremyevans authored and hsbt committed Jul 31, 2020
1 parent 331fe6a commit 1a93560
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/rubygems/core_ext/kernel_warn.rb
Expand Up @@ -38,10 +38,11 @@ class << self

start += 1

path = loc.path
unless path.start_with?(rubygems_path) or path.start_with?('<internal:')
# Non-rubygems frames
uplevel -= 1
if path = loc.path
unless path.start_with?(rubygems_path) or path.start_with?('<internal:')
# Non-rubygems frames
uplevel -= 1
end
end
end
uplevel = start
Expand Down

0 comments on commit 1a93560

Please sign in to comment.