summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-04-05 07:30:51 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-04-05 07:30:51 +0000
commit6469e9a5a338305c407b24fd8f072b1902671f92 (patch)
tree8566c29242d01778941e7ee2bdc8dd7e909bb363 /lib
parent0d029317594a87aeabd652ea6f0867680222ba3f (diff)
downloadredmine-6469e9a5a338305c407b24fd8f072b1902671f92.tar.gz
redmine-6469e9a5a338305c407b24fd8f072b1902671f92.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/unified_diff.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/redmine/unified_diff.rb b/lib/redmine/unified_diff.rb
index 968922a50..548003220 100644
--- a/lib/redmine/unified_diff.rb
+++ b/lib/redmine/unified_diff.rb
@@ -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