Guard for empty page
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2019-08-25 13:14:11 +02:00
parent 35849b8a33
commit 52d057f2e3

View File

@ -332,7 +332,7 @@ func (h *editHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
pageText := mp.Get(page).Content pageText := mp.Get(page).Content
jsonEditor := pageText[0] == '{' jsonEditor := pageText != "" && pageText[0] == '{'
var editor template.HTML var editor template.HTML
if jsonEditor { if jsonEditor {
@ -401,7 +401,7 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return return
} }
jsonPage := pageText[0] == '{' jsonPage := pageText != "" && pageText[0] == '{'
if jsonPage { if jsonPage {
pageText, err = renderJSON(pageText) pageText, err = renderJSON(pageText)