mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Fix the protected branch panic issue (#3567)
This commit is contained in:
		@@ -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,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user