summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routers/repo/middlewares.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go
index 6ff09cb845..e513189f6b 100644
--- a/routers/repo/middlewares.go
+++ b/routers/repo/middlewares.go
@@ -10,6 +10,11 @@ import (
// SetEditorconfigIfExists set editor config as render variable
func SetEditorconfigIfExists(ctx *context.Context) {
+ if ctx.Repo.Repository.IsEmpty {
+ ctx.Data["Editorconfig"] = nil
+ return
+ }
+
ec, err := ctx.Repo.GetEditorconfig()
if err != nil && !git.IsErrNotExist(err) {