mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-25 04:26:08 +10:00
Validate bounds just to be sure
This commit is contained in:
@@ -93,6 +93,9 @@ module Gitlab
|
||||
|
||||
# Inserts tags around the characters identified by the given range
|
||||
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)
|
||||
offset += before.length
|
||||
|
||||
|
||||
Reference in New Issue
Block a user