Skip to content

Commit bd13c81

Browse files
authored
Merge pull request #196 from Bwko/fix/commit-view-panic
Fix panic when no user is signed in
2 parents cf045b0 + 7b75d93 commit bd13c81

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

routers/repo/middlewares.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ func SetEditorconfigIfExists(ctx *context.Context) {
2323
}
2424

2525
func SetDiffViewStyle(ctx *context.Context) {
26+
queryStyle := ctx.Query("style")
27+
28+
if !ctx.IsSigned {
29+
ctx.Data["IsSplitStyle"] = queryStyle == "split"
30+
return
31+
}
32+
2633
var (
27-
userStyle = ctx.User.DiffViewStyle
28-
queryStyle = ctx.Query("style")
29-
style string
34+
userStyle = ctx.User.DiffViewStyle
35+
style string
3036
)
3137

3238
if queryStyle == "unified" || queryStyle == "split" {

0 commit comments

Comments
 (0)