admin: Fix nil pointer when seeing public team

This commit is contained in:
nemunaire 2022-06-08 03:06:29 +02:00
parent 159672ec47
commit 9ea415b857
1 changed files with 4 additions and 1 deletions

View File

@ -109,7 +109,10 @@ func declareTeamsRoutes(router *gin.RouterGroup) {
c.JSON(http.StatusOK, tfile)
})
apiTeamsPublicRoutes.GET("/stats.json", func(c *gin.Context) {
team := c.MustGet("team").(*fic.Team)
var team *fic.Team
if t, ok := c.Get("team"); ok && t != nil {
team = t.(*fic.Team)
}
if team != nil {
stats, err := team.GetStats()
if err != nil {