Add guardclause of offset < 0 in #truncate

This commit is contained in:
Shinya Maeda 2018-05-02 14:46:04 +09:00
parent 6ed91266d0
commit 4b34c875f7
1 changed files with 1 additions and 1 deletions

View File

@ -134,7 +134,7 @@ module Gitlab
end
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
@tell = offset