diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index 6409872ba4..93f054724f 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -345,8 +345,10 @@ eom ignore_stderr = nil end if res - res.backtrace.each do |l| - l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"} + if bt = res.backtrace + bt.each do |l| + l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"} + end end raise res end