From 9df6184e026c1b35ed437e1826b43f5e3e97648a Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Thu, 3 Feb 2022 10:25:52 +0100 Subject: [PATCH] Check for map key before usage --- routes.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/routes.go b/routes.go index 2cab220..71eac7d 100644 --- a/routes.go +++ b/routes.go @@ -42,7 +42,9 @@ func setupRoutes(router *mux.Router, routes []Route) { } infos = route.Setup(infos, r) - route.Title = strings.Replace(route.Title, "", infos["id"].(string), 1) + if id, ok := infos["id"]; ok { + route.Title = strings.Replace(route.Title, "", id.(string), 1) + } templates.Render(rw, r, route.Template, &templates.Page{ Title: route.Title,