Check for map key before usage

This commit is contained in:
Jan Eitzinger 2022-02-03 10:25:52 +01:00
parent 6025bbdecd
commit 9df6184e02

View File

@ -42,7 +42,9 @@ func setupRoutes(router *mux.Router, routes []Route) {
}
infos = route.Setup(infos, r)
route.Title = strings.Replace(route.Title, "<ID>", infos["id"].(string), 1)
if id, ok := infos["id"]; ok {
route.Title = strings.Replace(route.Title, "<ID>", id.(string), 1)
}
templates.Render(rw, r, route.Template, &templates.Page{
Title: route.Title,