fix pulls broken when fork repository deleted (#6754)

* fix pulls broken when fork repository deleted

* fix lint
This commit is contained in:
Lunny Xiao 2019-04-26 11:03:39 +08:00 committed by GitHub
parent ec2d489d15
commit 4c34bc111c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View file

@ -299,6 +299,10 @@ func (pr *PullRequest) GetLastCommitStatus() (status *CommitStatus, err error) {
return nil, err
}
if pr.HeadRepo == nil {
return nil, ErrPullRequestHeadRepoMissing{pr.ID, pr.HeadRepoID}
}
headGitRepo, err := git.OpenRepository(pr.HeadRepo.RepoPath())
if err != nil {
return nil, err