Fix the protected branch panic issue (#3567) (#3569)

Signed-off-by: Wendell Sun <iwendellsun@gmail.com>
This commit is contained in:
Wendell Sun 2018-02-24 01:27:34 +08:00 committed by Lauris BH
parent e55eaa8545
commit d87fb0a6fd

View file

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