aboutsummaryrefslogtreecommitdiffstats
path: root/models/branches.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/branches.go')
-rw-r--r--models/branches.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/models/branches.go b/models/branches.go
index d1921d5500..0a3d19858b 100644
--- a/models/branches.go
+++ b/models/branches.go
@@ -155,6 +155,10 @@ func (repo *Repository) GetProtectedBranches() ([]*ProtectedBranch, error) {
// IsProtectedBranch checks if branch is protected
func (repo *Repository) IsProtectedBranch(branchName string, doer *User) (bool, error) {
+ if doer == nil {
+ return true, nil
+ }
+
protectedBranch := &ProtectedBranch{
RepoID: repo.ID,
BranchName: branchName,