~netlandish/gobwebs

582da32e3e94befc3b9d9c6e2487d954d2049978 — Peter Sanchez 8 months ago df98b40
Account for situations when sessions are not available
1 files changed, 4 insertions(+), 0 deletions(-)

M core/local.go
M core/local.go => core/local.go +4 -0
@@ 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 {