Skip to content

Commit fb04cc7

Browse files
authored
Validate Issue Index before querying DB (#16406)
1 parent 18c18bb commit fb04cc7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

models/issue.go

Lines changed: 3 additions & 0 deletions
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)