From db87e91227d471b516d0c6b0423539ff54833f92 Mon Sep 17 00:00:00 2001 From: zeripath Date: Fri, 15 May 2020 21:44:33 +0100 Subject: [PATCH] Check that the ctx.User is not nil before checking its ID (#11424) Fix #11423 Signed-off-by: Andrew Thornton Co-authored-by: techknowlogick --- routers/repo/compare.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/compare.go b/routers/repo/compare.go index 29a543e67f..97bb5e6b18 100644 --- a/routers/repo/compare.go +++ b/routers/repo/compare.go @@ -215,7 +215,7 @@ func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, * // check if they have a fork of the base repo and offer that as // "OwnForkRepo" var ownForkRepo *models.Repository - if baseRepo.OwnerID != ctx.User.ID { + if ctx.User != nil && baseRepo.OwnerID != ctx.User.ID { repo, has := models.HasForkedRepo(ctx.User.ID, baseRepo.ID) if has { ownForkRepo = repo