summaryrefslogtreecommitdiffstats
path: root/models/pull.go
diff options
context:
space:
mode:
authorJonas Franz <info@jonasfranz.software>2018-12-17 18:35:21 +0100
committertechknowlogick <hello@techknowlogick.com>2018-12-17 12:35:21 -0500
commite726e4b828e9592085e6cf717a2e6c29b1c2d472 (patch)
tree113f014716328fb1b60d189962a8728fbd47143e /models/pull.go
parent8730ee0e4562c32c9933a63948200822146ab6cf (diff)
downloadgitea-e726e4b828e9592085e6cf717a2e6c29b1c2d472.tar.gz
gitea-e726e4b828e9592085e6cf717a2e6c29b1c2d472.zip
Add base repo nil check (#5555)
Signed-off-by: Jonas Franz <info@jonasfranz.software>
Diffstat (limited to 'models/pull.go')
-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
}