0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-21 23:31:40 +01:00

Fix the protected branch panic issue (#3567)

This commit is contained in:
Wendell Sun 2018-02-23 18:10:03 +08:00 committed by Lunny Xiao
parent 2d1c5c3756
commit d2d0aea8a1

View file

@ -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,