Skip to content

Commit db87e91

Browse files
Check that the ctx.User is not nil before checking its ID (#11424)
Fix #11423 Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent f7f04e9 commit db87e91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

routers/repo/compare.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *
215215
// check if they have a fork of the base repo and offer that as
216216
// "OwnForkRepo"
217217
var ownForkRepo *models.Repository
218-
if baseRepo.OwnerID != ctx.User.ID {
218+
if ctx.User != nil && baseRepo.OwnerID != ctx.User.ID {
219219
repo, has := models.HasForkedRepo(ctx.User.ID, baseRepo.ID)
220220
if has {
221221
ownForkRepo = repo

0 commit comments

Comments
 (0)