Переглянути джерело

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.
tags/v1.10.5
zeripath 4 роки тому
джерело
коміт
13c6681a07
Аккаунт користувача з таким Email не знайдено
1 змінених файлів з 5 додано та 0 видалено
  1. 5
    0
      services/pull/commit_status.go

+ 5
- 0
services/pull/commit_status.go Переглянути файл

@@ -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 {

Завантаження…
Відмінити
Зберегти