From 816cfb2a6e1f9b1370754ff8e0e8348511f7f40f Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 20 Aug 2017 10:23:04 +0100 Subject: [PATCH] Fix one bug Former-commit-id: 3886c36ab7a1a078f0f740caa7ca986490f50f8a [formerly f71de42494da68fac79b6618e03aa44ea8cf7d5b] [formerly af6208163a5bf54fa06171990cc8adb8f90f4834 [formerly 70751c48d28abe10eeeced5f0733e08f039e86c5]] Former-commit-id: 57015ba46af265788d5e1189e7f981aa3e9c2c2d [formerly b0a2660aaed889c9f36e3ba4e10f4a703e8763a1] Former-commit-id: 33279da11c9ce00ebb77feef419d6f6d82d9572a --- http/http.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/http/http.go b/http/http.go index f84782b3..7684a79e 100644 --- a/http/http.go +++ b/http/http.go @@ -224,10 +224,14 @@ func renderFile(c *fm.Context, w http.ResponseWriter, file string, contentType s tpl := template.Must(template.New("file").Parse(file)) w.Header().Set("Content-Type", contentType+"; charset=utf-8") - err := tpl.Execute(w, map[string]interface{}{ - "BaseURL": c.RootURL(), - "StaticGen": c.StaticGen.Name(), - }) + data := map[string]interface{}{"BaseURL": c.RootURL()} + + if c.StaticGen != nil { + data["StaticGen"] = c.StaticGen.Name() + } + + err := tpl.Execute(w, data) + if err != nil { return http.StatusInternalServerError, err }