diff options
author | Norwin | 2021-07-12 20:22:47 +0000 |
---|---|---|
committer | GitHub | 2021-07-12 16:22:47 -0400 |
commit | 58615be5234069af64d28428e39fa77255ad8aba (patch) | |
tree | 47b246e8b0c4158cb58797c79a9c130ed255f4bb | |
parent | 6df82db0f70c22ac749c31de356582eb7e8f026b (diff) |
Validate issue index before querying DB (#16406) (#16410)
-rw-r--r-- | models/issue.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/models/issue.go b/models/issue.go index 331ea01fd..f115d7621 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1034,6 +1034,9 @@ func newIssueAttempt(repo *Repository, issue *Issue, labelIDs []int64, uuids []s // GetIssueByIndex returns raw issue without loading attributes by index in a repository. func GetIssueByIndex(repoID, index int64) (*Issue, error) { + if index < 1 { + return nil, ErrIssueNotExist{} + } issue := &Issue{ RepoID: repoID, Index: index, |