fixed panic if no Accept-Lang header os set
This commit is contained in:
7
main.go
7
main.go
@@ -624,7 +624,12 @@ func getMatchChat(c *gin.Context) {
|
|||||||
c.Status(http.StatusBadRequest)
|
c.Status(http.StatusBadRequest)
|
||||||
return
|
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)
|
log.Debugf("[GMC] Got header %s, selected %s from %v (w: %v)", c.GetHeader("Accept-Language"), lang, tag, weights)
|
||||||
|
|
||||||
var translate bool
|
var translate bool
|
||||||
|
Reference in New Issue
Block a user