diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb index b4aebf878c..5516933a5c 100755 --- a/lib/rubygems/core_ext/kernel_require.rb +++ b/lib/rubygems/core_ext/kernel_require.rb @@ -40,7 +40,7 @@ module Kernel # https://github.com/rubygems/rubygems/pull/1868 resolved_path = begin rp = nil - $LOAD_PATH[0...Gem.load_path_insert_index].each do |lp| + $LOAD_PATH[0...Gem.load_path_insert_index || -1].each do |lp| safe_lp = lp.dup.untaint next if File.symlink? safe_lp # for backword compatibility Gem.suffixes.each do |s|