mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	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>
This commit is contained in:
		@@ -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
 | 
						// check if they have a fork of the base repo and offer that as
 | 
				
			||||||
	// "OwnForkRepo"
 | 
						// "OwnForkRepo"
 | 
				
			||||||
	var ownForkRepo *models.Repository
 | 
						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)
 | 
							repo, has := models.HasForkedRepo(ctx.User.ID, baseRepo.ID)
 | 
				
			||||||
		if has {
 | 
							if has {
 | 
				
			||||||
			ownForkRepo = repo
 | 
								ownForkRepo = repo
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user