mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 19:45:25 +01:00 
			
		
		
		
	Prevent nil pointer in GetPullRequestCommitStatusState (#10342)
Ensure that pr.HeadRepo is loaded before using it in GetPullRequestCommitStatusState. Fixes error on merging with successful commit merge statuses.
This commit is contained in:
		
							parent
							
								
									29efa9c3fb
								
							
						
					
					
						commit
						13c6681a07
					
				| @ -91,6 +91,11 @@ func IsPullCommitStatusPass(pr *models.PullRequest) (bool, error) { | ||||
| 
 | ||||
| // GetPullRequestCommitStatusState returns pull request merged commit status state | ||||
| func GetPullRequestCommitStatusState(pr *models.PullRequest) (structs.CommitStatusState, error) { | ||||
| 	// Ensure HeadRepo is loaded | ||||
| 	if err := pr.LoadHeadRepo(); err != nil { | ||||
| 		return "", errors.Wrap(err, "LoadHeadRepo") | ||||
| 	} | ||||
| 
 | ||||
| 	// check if all required status checks are successful | ||||
| 	headGitRepo, err := git.OpenRepository(pr.HeadRepo.RepoPath()) | ||||
| 	if err != nil { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user