Skip to content

Commit d2d0aea

Browse files
xwjdshlunny
authored andcommitted
Fix the protected branch panic issue (#3567)
1 parent 2d1c5c3 commit d2d0aea

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

models/branches.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ func (repo *Repository) GetProtectedBranches() ([]*ProtectedBranch, error) {
155155

156156
// IsProtectedBranch checks if branch is protected
157157
func (repo *Repository) IsProtectedBranch(branchName string, doer *User) (bool, error) {
158+
if doer == nil {
159+
return true, nil
160+
}
161+
158162
protectedBranch := &ProtectedBranch{
159163
RepoID: repo.ID,
160164
BranchName: branchName,

0 commit comments

Comments
 (0)