diff options
author | zeripath <art27@cantab.net> | 2020-05-15 21:44:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-15 16:44:33 -0400 |
commit | db87e91227d471b516d0c6b0423539ff54833f92 (patch) | |
tree | 71dbc02c0bf80dc44d8d1743b432c1b49b01ef15 /routers/repo/compare.go | |
parent | f7f04e94bd4b2f74c572ce62f3a3d952b1b67ba8 (diff) | |
download | gitea-db87e91227d471b516d0c6b0423539ff54833f92.tar.gz gitea-db87e91227d471b516d0c6b0423539ff54833f92.zip |
Check that the ctx.User is not nil before checking its ID (#11424)
Fix #11423
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'routers/repo/compare.go')
-rw-r--r-- | routers/repo/compare.go | 2 |
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 |