fix: prevent nil pointer when err session retrieval fails
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good

see https://sentry.in.nuonet.fr/share/issue/48b82c13ee3f4721bb6306b533799709/
This commit is contained in:
wpetit 2024-11-14 10:10:16 +01:00
parent 7cc9de180c
commit ce7415af20

View File

@ -64,13 +64,14 @@ func (s *Store) New(r *http.Request, name string) (*sessions.Session, error) {
if err != nil { if err != nil {
return session, nil return session, nil
} }
session.ID = c.Value session.ID = c.Value
err = s.load(r.Context(), session) err = s.load(r.Context(), session)
if err == nil { if err == nil {
session.IsNew = false session.IsNew = false
} else if !errors.Is(err, ErrNotFound) { } else if !errors.Is(err, ErrNotFound) {
return nil, errors.WithStack(err) return session, errors.WithStack(err)
} }
return session, nil return session, nil