aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/compare.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/repo/compare.go')
-rw-r--r--routers/web/repo/compare.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go
index 71ca4df93e..556a6218a6 100644
--- a/routers/web/repo/compare.go
+++ b/routers/web/repo/compare.go
@@ -635,7 +635,7 @@ func getBranchesAndTagsForRepo(user *models.User, repo *models.Repository) (bool
func CompareDiff(ctx *context.Context) {
ci := ParseCompareInfo(ctx)
defer func() {
- if ci.HeadGitRepo != nil {
+ if ci != nil && ci.HeadGitRepo != nil {
ci.HeadGitRepo.Close()
}
}()