summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorBwko <bouwko@gmail.com>2016-11-19 12:43:10 +0100
committerBwko <bouwko@gmail.com>2016-11-19 12:43:10 +0100
commitfc3ed8a1de0e35eefff083176211c4eb61a264ca (patch)
tree2da98e3d5e0708ee0f76e32a7c5cfd6afeda996b /routers
parentcf045b029cc11dc48c3a626441b7017710088823 (diff)
downloadgitea-fc3ed8a1de0e35eefff083176211c4eb61a264ca.tar.gz
gitea-fc3ed8a1de0e35eefff083176211c4eb61a264ca.zip
Fix panic when no user is signed in
See #188
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/middlewares.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go
index 757a049ab7..b16b003cfe 100644
--- a/routers/repo/middlewares.go
+++ b/routers/repo/middlewares.go
@@ -23,6 +23,10 @@ func SetEditorconfigIfExists(ctx *context.Context) {
}
func SetDiffViewStyle(ctx *context.Context) {
+ if !ctx.IsSigned {
+ return
+ }
+
var (
userStyle = ctx.User.DiffViewStyle
queryStyle = ctx.Query("style")