Add guardclause of offset < 0 in #truncate
This commit is contained in:
parent
6ed91266d0
commit
4b34c875f7
|
@ -134,7 +134,7 @@ module Gitlab
|
||||||
end
|
end
|
||||||
|
|
||||||
def truncate(offset)
|
def truncate(offset)
|
||||||
raise ArgumentError, 'Outside of file' if offset > size
|
raise ArgumentError, 'Outside of file' if offset > size || offset < 0
|
||||||
return if offset == size # Skip the following process as it doesn't affect anything
|
return if offset == size # Skip the following process as it doesn't affect anything
|
||||||
|
|
||||||
@tell = offset
|
@tell = offset
|
||||||
|
|
Loading…
Reference in New Issue