diff options
author | Wendell Sun <iwendellsun@gmail.com> | 2018-02-24 01:27:34 +0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-02-23 19:27:34 +0200 |
commit | d87fb0a6fd6154ac7810c27b02bcbfc52e850460 (patch) | |
tree | 939b242d4779f4dbf62fa3f5710491f26401c061 | |
parent | e55eaa8545a87dcbcc511d1e4acb1f0398d252dd (diff) | |
download | gitea-d87fb0a6fd6154ac7810c27b02bcbfc52e850460.tar.gz gitea-d87fb0a6fd6154ac7810c27b02bcbfc52e850460.zip |
Fix the protected branch panic issue (#3567) (#3569)
Signed-off-by: Wendell Sun <iwendellsun@gmail.com>
-rw-r--r-- | models/branches.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/models/branches.go b/models/branches.go index 7cc0ebab4d..bf5d4fdb49 100644 --- a/models/branches.go +++ b/models/branches.go @@ -156,6 +156,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, |