summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2023-01-18 20:54:57 +0100
committerGitHub <noreply@github.com>2023-01-18 13:54:57 -0600
commitaa87b3690081261379c6b93488cdd3f3f7b1ef31 (patch)
tree7cbb69f411fcd5bced290fd9deee3e11ea5335a2 /services
parent4804900ac935c5f9d4e47c0b0827be4c232bd0e5 (diff)
downloadgitea-aa87b3690081261379c6b93488cdd3f3f7b1ef31.tar.gz
gitea-aa87b3690081261379c6b93488cdd3f3f7b1ef31.zip
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.
Diffstat (limited to 'services')
-rw-r--r--services/pull/update.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/services/pull/update.go b/services/pull/update.go
index 9e29f63c7c..ede89bcdff 100644
--- a/services/pull/update.go
+++ b/services/pull/update.go
@@ -118,6 +118,9 @@ func IsUserAllowedToUpdate(ctx context.Context, pull *issues_model.PullRequest,
}
prUnit, err := pr.BaseRepo.GetUnit(ctx, 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
}