Validate issue index before querying DB (#16406) (#16410)

This commit is contained in:
Norwin authored and GitHub committed 2021-07-12 16:22:47 -04:00
1 parent 6df82db0f7
commit 58615be523
1 file changed
+3
+3
View File
@@ -1034,6 +1034,9 @@ func newIssueAttempt(repo *Repository, issue *Issue, labelIDs []int64, uuids []s
// 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,