From: 6543 <6543@obermui.de> Date: Thu, 4 Mar 2021 20:28:28 +0000 (+0100) Subject: IsUserAllowedToUpdate should igonre if user is nil (#14886) X-Git-Tag: v1.13.4~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8a6acbbc129c41bad4663e7ab3d89fd76b818981;p=gitea.git IsUserAllowedToUpdate should igonre if user is nil (#14886) --- 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