summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-03-04 19:27:54 +0100
committerGitHub <noreply@github.com>2021-03-04 19:27:54 +0100
commit11229ca53990fcb163b35295a2300daaf3ba7f47 (patch)
tree55eaafd1c13e6d3eebedea1928b4eded89975b0e
parent8ac136771821d831cd1d73c9d53b3540e8eb06ff (diff)
downloadgitea-11229ca53990fcb163b35295a2300daaf3ba7f47.tar.gz
gitea-11229ca53990fcb163b35295a2300daaf3ba7f47.zip
IsUserAllowedToUpdate ignore igonre if user is nil (#14885)
-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 0829b1c5d6..f4f7859a49 100644
--- a/services/pull/update.go
+++ b/services/pull/update.go
@@ -48,6 +48,9 @@ func Update(pull *models.PullRequest, doer *models.User, message string) error {
// IsUserAllowedToUpdate check if user is allowed to update PR with given permissions and branch protections
func IsUserAllowedToUpdate(pull *models.PullRequest, user *models.User) (bool, error) {
+ if user == nil {
+ return false, nil
+ }
headRepoPerm, err := models.GetUserRepoPermission(pull.HeadRepo, user)
if err != nil {
return false, err