Skip to content

Commit d87fb0a

Browse files
xwjdshlafriks
authored andcommitted
Fix the protected branch panic issue (#3567) (#3569)
Signed-off-by: Wendell Sun <[email protected]>
1 parent e55eaa8 commit d87fb0a

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
@@ -156,6 +156,10 @@ func (repo *Repository) GetProtectedBranches() ([]*ProtectedBranch, error) {
156156

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

0 commit comments

Comments
 (0)