From ce7415af20f443f2397c4d1dd00ab77c040f55cc Mon Sep 17 00:00:00 2001 From: William Petit Date: Thu, 14 Nov 2024 10:10:16 +0100 Subject: [PATCH] fix: prevent nil pointer when err session retrieval fails see https://sentry.in.nuonet.fr/share/issue/48b82c13ee3f4721bb6306b533799709/ --- internal/session/store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/session/store.go b/internal/session/store.go index 3a9627f..969d669 100644 --- a/internal/session/store.go +++ b/internal/session/store.go @@ -64,13 +64,14 @@ func (s *Store) New(r *http.Request, name string) (*sessions.Session, error) { if err != nil { return session, nil } + session.ID = c.Value err = s.load(r.Context(), session) if err == nil { session.IsNew = false } else if !errors.Is(err, ErrNotFound) { - return nil, errors.WithStack(err) + return session, errors.WithStack(err) } return session, nil