diff options
author | Norwin <noerw@users.noreply.github.com> | 2021-07-12 20:22:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 16:22:27 -0400 |
commit | fb04cc7dbd619589e45180e1a017c8039ecd9342 (patch) | |
tree | 1175962fdd7da1608ea112f17272345abc3891ba /models | |
parent | 18c18bb196eee704db5d15140886a4d399d51af9 (diff) | |
download | gitea-fb04cc7dbd619589e45180e1a017c8039ecd9342.tar.gz gitea-fb04cc7dbd619589e45180e1a017c8039ecd9342.zip |
Validate Issue Index before querying DB (#16406)
Diffstat (limited to 'models')
-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 b9643ae00e..225dfee20f 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1018,6 +1018,9 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string) // 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, |