Skip to content

Commit 3611bc8

Browse files
noerwAbdulrhmnGhanem
authored andcommitted
Validate Issue Index before querying DB (go-gitea#16406)
1 parent c79c130 commit 3611bc8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

models/issue.go

+3
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,9 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string)
10181018

10191019
// GetIssueByIndex returns raw issue without loading attributes by index in a repository.
10201020
func GetIssueByIndex(repoID, index int64) (*Issue, error) {
1021+
if index < 1 {
1022+
return nil, ErrIssueNotExist{}
1023+
}
10211024
issue := &Issue{
10221025
RepoID: repoID,
10231026
Index: index,

0 commit comments

Comments
 (0)