summaryrefslogtreecommitdiffstats
path: root/modules/middleware
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-20 02:25:21 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-20 02:25:21 -0400
commitf9fd972cbef25c379ab465ac8a568ef99d44f8da (patch)
tree2c4c47975dc6c07e20cbb243837dced73ae30a25 /modules/middleware
parenta10e126803920f0b6f676acb4f0c5e8eb7b995de (diff)
downloadgitea-f9fd972cbef25c379ab465ac8a568ef99d44f8da.tar.gz
gitea-f9fd972cbef25c379ab465ac8a568ef99d44f8da.zip
Bug fix
Diffstat (limited to 'modules/middleware')
-rw-r--r--modules/middleware/repo.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index f0cab8e895..b25c942316 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -65,9 +65,11 @@ func RepoAssignment(redirect bool) martini.Handler {
}
ctx.Repo.IsValid = true
- ctx.Repo.IsWatching = models.IsWatching(ctx.User.Id, repo.Id)
+ if ctx.User != nil {
+ ctx.Repo.IsWatching = models.IsWatching(ctx.User.Id, repo.Id)
+ }
ctx.Repo.Repository = repo
- ctx.Repo.CloneLink.SSH = fmt.Sprintf("git@%s:%s/%s.git", base.Domain, ctx.User.LowerName, repo.LowerName)
+ ctx.Repo.CloneLink.SSH = fmt.Sprintf("git@%s:%s/%s.git", base.Domain, user.LowerName, repo.LowerName)
ctx.Data["IsRepositoryValid"] = true
ctx.Data["Repository"] = repo