diff --git a/services/pull/merge.go b/services/pull/merge.go index 2d4d9722e83..a20a2140143 100644 --- a/services/pull/merge.go +++ b/services/pull/merge.go @@ -535,6 +535,9 @@ func IsSignedIfRequired(pr *models.PullRequest, doer *models.User) (bool, error) // IsUserAllowedToMerge check if user is allowed to merge PR with given permissions and branch protections func IsUserAllowedToMerge(pr *models.PullRequest, p models.Permission, user *models.User) (bool, error) { + if user == nil { + return false, nil + } err := pr.LoadProtectedBranch() if err != nil {