Commit 6000f854 authored by Douwe Maan's avatar Douwe Maan

Validate bounds just to be sure

parent 0e992a3b
...@@ -93,6 +93,9 @@ module Gitlab ...@@ -93,6 +93,9 @@ module Gitlab
# Inserts tags around the characters identified by the given range # Inserts tags around the characters identified by the given range
def insert_around_range(text, range, before, after, offset = 0) def insert_around_range(text, range, before, after, offset = 0)
# Just to be sure
return offset if offset + range.end + 1 > text.length
text.insert(offset + range.begin, before) text.insert(offset + range.begin, before)
offset += before.length offset += before.length
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment