Browse Source

Add base repo nil check (#5555)

Signed-off-by: Jonas Franz <info@jonasfranz.software>
for-closed-social
Jonas Franz 5 years ago
committed by techknowlogick
parent
commit
e726e4b828
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      models/pull.go

+ 9
- 0
models/pull.go View File

@ -113,6 +113,15 @@ func (pr *PullRequest) loadIssue(e Engine) (err error) {
// LoadProtectedBranch loads the protected branch of the base branch
func (pr *PullRequest) LoadProtectedBranch() (err error) {
if pr.BaseRepo == nil {
if pr.BaseRepoID == 0 {
return nil
}
pr.BaseRepo, err = GetRepositoryByID(pr.BaseRepoID)
if err != nil {
return
}
}
pr.ProtectedBranch, err = GetProtectedBranchBy(pr.BaseRepo.ID, pr.BaseBranch)
return
}

Loading…
Cancel
Save