Skip to content

Commit d13427d

Browse files
committed
Add nil check
1 parent f09a125 commit d13427d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

models/repo.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ func (repo *Repository) CanBeForked() bool {
636636

637637
// CanUserFork returns true if specified user can fork repository.
638638
func (repo *Repository) CanUserFork(user *User) (bool, error) {
639+
if user == nil {
640+
return false, nil
641+
}
639642
if repo.OwnerID != user.ID && !user.HasForkedRepo(repo.ID) {
640643
return true, nil
641644
}

0 commit comments

Comments
 (0)