Skip to content

Commit

Permalink
Validate Issue Index before querying DB (go-gitea#16406)
Browse files Browse the repository at this point in the history
  • Loading branch information
noerw authored and AbdulrhmnGhanem committed Aug 10, 2021
1 parent c79c130 commit 3611bc8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3611bc8

Please sign in to comment.