Fix nil pointer exception
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2023-04-11 15:33:00 +02:00
parent ba6e1490c3
commit 2f2f80fa1b

View File

@ -511,7 +511,7 @@ func TriggerTagUpdate(c *gin.Context, work *Work, repo *Repository, u *User, tag
loggeduser := c.MustGet("LoggedUser").(*User) loggeduser := c.MustGet("LoggedUser").(*User)
now := time.Now() now := time.Now()
if !loggeduser.IsAdmin && (!work.Shown || work.Corrected || work.StartAvailability.After(now) || work.EndAvailability.Add(time.Hour).Before(now)) { if (loggeduser == nil || !loggeduser.IsAdmin) && (!work.Shown || work.Corrected || work.StartAvailability.After(now) || work.EndAvailability.Add(time.Hour).Before(now)) {
c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"errmsg": "The submission is closed."}) c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"errmsg": "The submission is closed."})
return return
} }