From 582da32e3e94befc3b9d9c6e2487d954d2049978 Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Sat, 9 Mar 2024 14:13:08 -0600 Subject: [PATCH] Account for situations when sessions are not available --- core/local.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/local.go b/core/local.go index 8df19e4..6fea1cd 100644 --- a/core/local.go +++ b/core/local.go @@ -20,6 +20,10 @@ func SetLang(c echo.Context, lang string) error { // GetLang sets language in the users session func GetLang(c echo.Context) string { gctx := c.(*server.Context) + if gctx.Server.Session == nil { + return GetDefaultLang() + } + l := gctx.Server.Session.Get(c.Request().Context(), sessionLanguage) lang, ok := l.(string) if !ok { -- 2.43.0