summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorBwko <bouwko@gmail.com>2017-07-31 03:23:10 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2017-07-31 09:23:10 +0800
commit119362701471c0cb6bdd1a61ac5701800e97f7bd (patch)
tree5dbeface393ff605babe57ed6c498ceb8f2aaf89 /routers
parent9a505fafda9e7dfc310ce57d58e5f49562a17011 (diff)
downloadgitea-119362701471c0cb6bdd1a61ac5701800e97f7bd.tar.gz
gitea-119362701471c0cb6bdd1a61ac5701800e97f7bd.zip
Fix Commits nil pointer dereference (#2203)
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/commit.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 22de2450f2..1835e47318 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -47,6 +47,10 @@ func renderIssueLinks(oldCommits *list.List, repoLink string) *list.List {
// Commits render branch's commits
func Commits(ctx *context.Context) {
ctx.Data["PageIsCommits"] = true
+ if ctx.Repo.Commit == nil {
+ ctx.Handle(404, "Commit not found", nil)
+ return
+ }
commitsCount, err := ctx.Repo.Commit.CommitsCount()
if err != nil {