summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/pull.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/pull.go')
-rw-r--r--routers/api/v1/repo/pull.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index f6507dceba..ebb9c0f261 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -1443,7 +1443,11 @@ func GetPullRequestFiles(ctx *context.APIContext) {
end = totalNumberOfFiles
}
- apiFiles := make([]*api.ChangedFile, 0, end-start)
+ lenFiles := end - start
+ if lenFiles < 0 {
+ lenFiles = 0
+ }
+ apiFiles := make([]*api.ChangedFile, 0, lenFiles)
for i := start; i < end; i++ {
apiFiles = append(apiFiles, convert.ToChangedFile(diff.Files[i], pr.HeadRepo, endCommitID))
}