From ffd38905845684e5e3f86743c2da33a09aa81b40 Mon Sep 17 00:00:00 2001 From: Teajey <21069848+Teajey@users.noreply.github.com> Date: Sun, 29 Dec 2024 20:41:42 +1300 Subject: [PATCH] fix: check if session exists for see other --- server/rsvp/response.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/server/rsvp/response.go b/server/rsvp/response.go index d5653db..c72536f 100644 --- a/server/rsvp/response.go +++ b/server/rsvp/response.go @@ -29,11 +29,13 @@ func (res *Response) Write(w http.ResponseWriter, r *http.Request) error { if res.SeeOther != "" { http.Redirect(w, r, res.SeeOther, http.StatusSeeOther) - flash := res.Session.FlashPeek() - if flash != nil { - err := json.NewEncoder(w).Encode(flash) - if err != nil { - return err + if res.Session != nil { + flash := res.Session.FlashPeek() + if flash != nil { + err := json.NewEncoder(w).Encode(flash) + if err != nil { + return err + } } } return nil