aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author65432021-03-04 21:28:28 +0100
committerGitHub2021-03-04 21:28:28 +0100
commit8a6acbbc129c41bad4663e7ab3d89fd76b818981 (patch)
tree07104c415fab85cbc45bafc40261013ed3d50280
parent98b3d8d5e178807c770298f39624e78facbb8017 (diff)
IsUserAllowedToUpdate should igonre if user is nil (#14886)
-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 0829b1c5d..f4f7859a4 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