Skip to content

Commit a7f5268

Browse files
zeripathwxiaoguang
andauthored
Prevent NPE when checking repo units if the user is nil (#19625)
CheckRepoUnitUser should tolerate nil users. Fix #19613 Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
1 parent 4691e59 commit a7f5268

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func CheckRepoUnitUser(repo *repo_model.Repository, user *user_model.User, unitT
5454
}
5555

5656
func checkRepoUnitUser(ctx context.Context, repo *repo_model.Repository, user *user_model.User, unitType unit.Type) bool {
57-
if user.IsAdmin {
57+
if user != nil && user.IsAdmin {
5858
return true
5959
}
6060
perm, err := GetUserRepoPermission(ctx, repo, user)

0 commit comments

Comments
 (0)