summaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/repo/compare.go2
-rw-r--r--routers/web/repo/pull.go2
2 files changed, 2 insertions, 2 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()
}
}()
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index 1b15ea9a79..9c9cf0f21d 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -1043,7 +1043,7 @@ func CompareAndPullRequestPost(ctx *context.Context) {
ci := ParseCompareInfo(ctx)
defer func() {
- if ci.HeadGitRepo != nil {
+ if ci != nil && ci.HeadGitRepo != nil {
ci.HeadGitRepo.Close()
}
}()