Skip to content

Commit

Permalink
Check that the ctx.User is not nil before checking its ID (#11424)
Browse files Browse the repository at this point in the history
Fix #11423

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: techknowlogick <[email protected]>
  • Loading branch information
zeripath and techknowlogick authored May 15, 2020
1 parent f7f04e9 commit db87e91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routers/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db87e91

Please sign in to comment.