Fix GetPullRequestByIndex by validate index > 1 Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de> Co-authored-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
parent
28971c7c15
commit
6995be66e7
3 changed files with 11 additions and 18 deletions
|
@ -502,6 +502,9 @@ func GetLatestPullRequestByHeadInfo(repoID int64, branch string) (*PullRequest,
|
|||
|
||||
// GetPullRequestByIndex returns a pull request by the given index
|
||||
func GetPullRequestByIndex(repoID, index int64) (*PullRequest, error) {
|
||||
if index < 1 {
|
||||
return nil, ErrPullRequestNotExist{}
|
||||
}
|
||||
pr := &PullRequest{
|
||||
BaseRepoID: repoID,
|
||||
Index: index,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue