diff --git a/models/repo.go b/models/repo.go index e82fd5dedf0ce..29bb196e8e893 100644 --- a/models/repo.go +++ b/models/repo.go @@ -132,7 +132,7 @@ func CheckRepoUnitUser(repo *repo_model.Repository, user *user_model.User, unitT } func checkRepoUnitUser(ctx context.Context, repo *repo_model.Repository, user *user_model.User, unitType unit.Type) bool { - if user.IsAdmin { + if user != nil && user.IsAdmin { return true } perm, err := getUserRepoPermission(ctx, repo, user)