Skip to content

Commit

Permalink
Fix 500 error viewing pull request when fork has pull requests disabl…
Browse files Browse the repository at this point in the history
…ed (go-gitea#22512)

Swallow error just like in go-gitea#20839, for the case where there is no
protected branch.

Fixes go-gitea#20826 for me, though I can't tell if this now covers all cases.
  • Loading branch information
brechtvl authored and jolheiser committed Jan 18, 2023
1 parent e6e2c2f commit 737e2b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions services/pull/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ func IsUserAllowedToUpdate(ctx context.Context, pull *issues_model.PullRequest,
if pr.ProtectedBranch == nil {
prUnit, err := pr.BaseRepo.GetUnit(unit.TypePullRequests)
if err != nil {
if repo_model.IsErrUnitTypeNotExist(err) {
return false, false, nil
}
log.Error("pr.BaseRepo.GetUnit(unit.TypePullRequests): %v", err)
return false, false, err
}
Expand Down

0 comments on commit 737e2b3

Please sign in to comment.