1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Fix Kernel#warn override to handle backtrace location 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.

511935645a
This commit is contained in:
Jeremy Evans 2020-07-24 08:09:50 -07:00 committed by Hiroshi SHIBATA
parent 331fe6a88f
commit 1a935606b5
Notes: git 2020-07-31 21:08:23 +09:00

View file

@ -38,10 +38,11 @@ if RUBY_VERSION >= "2.5"
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