summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routers/repo/compare.go2
1 files changed, 1 insertions, 1 deletions
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