summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/pull.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/pull.go b/models/pull.go
index 0d8886186e..4c4c3f3e1e 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -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
}