fixed panic if no Accept-Lang header os set

This commit is contained in:
2022-09-13 06:04:40 +02:00
parent 64cba30917
commit 20289eb01f

View File

@@ -624,7 +624,12 @@ func getMatchChat(c *gin.Context) {
c.Status(http.StatusBadRequest)
return
}
lang, _ := tag[0].Base()
var lang string
if len(tag) > 0 {
lang, _ = tag[0].Base()
} else {
lang = "en"
}
log.Debugf("[GMC] Got header %s, selected %s from %v (w: %v)", c.GetHeader("Accept-Language"), lang, tag, weights)
var translate bool