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

This commit is contained in:
nemunaire 2022-03-03 19:37:17 +01:00
parent e9460527b7
commit c2201527b1

View File

@ -53,7 +53,7 @@ func init() {
}, adminRestricted))
router.GET("/api/surveys/:sid", apiAuthHandler(surveyAuthHandler(
func(s Survey, u *User, _ []byte) HTTPResponse {
if (s.Promo == u.Promo && (s.Group == "" || (u != nil && strings.Contains(u.Groups, ","+s.Group+",")) && s.Shown)) || (u != nil && u.IsAdmin) {
if ((u != nil && s.Promo == u.Promo) && (s.Group == "" || (u != nil && strings.Contains(u.Groups, ","+s.Group+",")) && s.Shown)) || (u != nil && u.IsAdmin) {
return APIResponse{s}
} else {
return APIErrorResponse{