Skip to content

Commit aa87b36

Browse files
authored
Fix 500 error viewing pull request when fork has pull requests disabled (#22512)
Swallow error just like in #20839, for the case where there is no protected branch. Fixes #20826 for me, though I can't tell if this now covers all cases.
1 parent 4804900 commit aa87b36

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

services/pull/update.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ func IsUserAllowedToUpdate(ctx context.Context, pull *issues_model.PullRequest,
118118
}
119119
prUnit, err := pr.BaseRepo.GetUnit(ctx, unit.TypePullRequests)
120120
if err != nil {
121+
if repo_model.IsErrUnitTypeNotExist(err) {
122+
return false, false, nil
123+
}
121124
log.Error("pr.BaseRepo.GetUnit(unit.TypePullRequests): %v", err)
122125
return false, false, err
123126
}

0 commit comments

Comments
 (0)