diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index d9baefe7c1..474d7503e4 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -419,9 +419,7 @@ func DiffPreviewPost(ctx *context.Context) { return } - if diff.NumFiles == 0 { - ctx.Data["File"] = nil - } else { + if diff.NumFiles != 0 { ctx.Data["File"] = diff.Files[0] }