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:
parent
331fe6a88f
commit
1a935606b5
Notes:
git
2020-07-31 21:08:23 +09:00
1 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue