diff --git a/admin/api/team.go b/admin/api/team.go index d43e2898..e62f5da9 100644 --- a/admin/api/team.go +++ b/admin/api/team.go @@ -90,7 +90,11 @@ func declareTeamsRoutes(router *gin.RouterGroup) { apiTeamsPublicRoutes := router.Group("/teams/:tid") apiTeamsPublicRoutes.Use(TeamPublicHandler) apiTeamsPublicRoutes.GET("/my.json", func(c *gin.Context) { - tfile, err := fic.MyJSONTeam(c.MustGet("team").(*fic.Team), true) + var team *fic.Team + if t, ok := c.Get("team"); ok && t != nil { + team = t.(*fic.Team) + } + tfile, err := fic.MyJSONTeam(team, true) if err != nil { log.Println("Unable to get MyJSONTeam:", err.Error()) c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs during team JSON generation."}) @@ -100,7 +104,11 @@ func declareTeamsRoutes(router *gin.RouterGroup) { c.JSON(http.StatusOK, tfile) }) apiTeamsPublicRoutes.GET("/wait.json", func(c *gin.Context) { - tfile, err := fic.MyJSONTeam(c.MustGet("team").(*fic.Team), false) + var team *fic.Team + if t, ok := c.Get("team"); ok && t != nil { + team = t.(*fic.Team) + } + tfile, err := fic.MyJSONTeam(team, false) if err != nil { log.Println("Unable to get MyJSONTeam:", err.Error()) c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs during team JSON generation."})