mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-24 11:31:54 +01:00
Fix the protected branch panic issue (#3567)
This commit is contained in:
parent
2d1c5c3756
commit
d2d0aea8a1
1 changed files with 4 additions and 0 deletions
|
@ -155,6 +155,10 @@ func (repo *Repository) GetProtectedBranches() ([]*ProtectedBranch, error) {
|
||||||
|
|
||||||
// IsProtectedBranch checks if branch is protected
|
// IsProtectedBranch checks if branch is protected
|
||||||
func (repo *Repository) IsProtectedBranch(branchName string, doer *User) (bool, error) {
|
func (repo *Repository) IsProtectedBranch(branchName string, doer *User) (bool, error) {
|
||||||
|
if doer == nil {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
protectedBranch := &ProtectedBranch{
|
protectedBranch := &ProtectedBranch{
|
||||||
RepoID: repo.ID,
|
RepoID: repo.ID,
|
||||||
BranchName: branchName,
|
BranchName: branchName,
|
||||||
|
|
Loading…
Reference in a new issue