diff --git a/renderer/renderer.go b/renderer/renderer.go index e4443e9c..980030d6 100644 --- a/renderer/renderer.go +++ b/renderer/renderer.go @@ -247,7 +247,9 @@ func (rend *HTMLRenderer) Render(w http.ResponseWriter, r *http.Request, data in rend.writeError(w, r, &htmlTemplateData{err, nil}) } - log.Println("Current user is", r.Context().Value("user").(*jwt.Token).Claims.(jwt.MapClaims)["name"]) + if r.Context().Value("user") != nil { + log.Println("Current user is", r.Context().Value("user").(*jwt.Token).Claims.(jwt.MapClaims)["name"]) + } w.Header().Set("Content-Type", "text/html; charset=utf-8") err := t.ExecuteTemplate(w, options[0]["tpl_layout"][0], &htmlTemplateData{data, options[0]})