fix diff error in case of line_left out of range (#13644)

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11707 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2013-04-05 07:30:51 +00:00
parent 0d02931759
commit 6469e9a5a3
4 changed files with 80 additions and 2 deletions
+2 -2
View File
@@ -199,7 +199,7 @@ module Redmine
while starting < max && line_left[starting] == line_right[starting]
starting += 1
end
unless "".respond_to?(:force_encoding)
if (! "".respond_to?(:force_encoding)) && starting < line_left.size
while line_left[starting].ord.between?(128, 191) && starting > 0
starting -= 1
end
@@ -208,7 +208,7 @@ module Redmine
while ending >= -(max - starting) && line_left[ending] == line_right[ending]
ending -= 1
end
unless "".respond_to?(:force_encoding)
if (! "".respond_to?(:force_encoding)) && ending > (-1 * line_left.size)
while line_left[ending].ord.between?(128, 191) && ending > -1
ending -= 1
end