diff options
author | Andrey Nering <andrey.nering@gmail.com> | 2016-11-19 14:30:37 -0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-19 14:30:37 -0200 |
commit | bd13c816845356e96be507b69b8c733cc788b2d2 (patch) | |
tree | 059f1b6d40797680a60aec0b81df583e12c6bb85 /routers | |
parent | cf045b029cc11dc48c3a626441b7017710088823 (diff) | |
parent | 7b75d93f3da42a9ea1783b0cb85f88977549cf05 (diff) | |
download | gitea-bd13c816845356e96be507b69b8c733cc788b2d2.tar.gz gitea-bd13c816845356e96be507b69b8c733cc788b2d2.zip |
Merge pull request #196 from Bwko/fix/commit-view-panic
Fix panic when no user is signed in
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/middlewares.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go index 757a049ab7..11b0009dbf 100644 --- a/routers/repo/middlewares.go +++ b/routers/repo/middlewares.go @@ -23,10 +23,16 @@ func SetEditorconfigIfExists(ctx *context.Context) { } func SetDiffViewStyle(ctx *context.Context) { + queryStyle := ctx.Query("style") + + if !ctx.IsSigned { + ctx.Data["IsSplitStyle"] = queryStyle == "split" + return + } + var ( - userStyle = ctx.User.DiffViewStyle - queryStyle = ctx.Query("style") - style string + userStyle = ctx.User.DiffViewStyle + style string ) if queryStyle == "unified" || queryStyle == "split" { |