Skip to content

Commit

Permalink
Fix the protected branch panic issue (go-gitea#3567)
Browse files Browse the repository at this point in the history
  • Loading branch information
xwjdsh authored and lunny committed Feb 23, 2018
1 parent 2d1c5c3 commit d2d0aea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions models/branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d2d0aea

Please sign in to comment.