Skip to content

Commit 58615be

Browse files
authored
Validate issue index before querying DB (#16406) (#16410)
1 parent 6df82db commit 58615be

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
@@ -1034,6 +1034,9 @@ func newIssueAttempt(repo *Repository, issue *Issue, labelIDs []int64, uuids []s
10341034

10351035
// GetIssueByIndex returns raw issue without loading attributes by index in a repository.
10361036
func GetIssueByIndex(repoID, index int64) (*Issue, error) {
1037+
if index < 1 {
1038+
return nil, ErrIssueNotExist{}
1039+
}
10371040
issue := &Issue{
10381041
RepoID: repoID,
10391042
Index: index,

0 commit comments

Comments
 (0)