diff --git a/main.go b/main.go index 21e8fad..40d7bd7 100644 --- a/main.go +++ b/main.go @@ -107,7 +107,13 @@ func main() { func getLang(c *gin.Context) string { session := sessions.Default(c) - lang := session.Get("lang").(string) + lang := session.Get("lang") + if lang == nil { + lang = "" + } else { + lang = lang.(string) + } + pLang, hasParam := c.Params.Get("lang") if hasParam && pLang != lang { lang = pLang @@ -121,7 +127,7 @@ func getLang(c *gin.Context) string { session.Save() } - return lang + return lang.(string) } func getGameFlow(c *gin.Context) (string, int) {