fix: check if session exists for see other

This commit is contained in:
Teajey 2024-12-29 20:41:42 +13:00
parent dd952a1f39
commit ffd3890584
Signed by: Teajey
GPG Key ID: 970E790FE834A713
1 changed files with 7 additions and 5 deletions

View File

@ -29,11 +29,13 @@ func (res *Response) Write(w http.ResponseWriter, r *http.Request) error {
if res.SeeOther != "" { if res.SeeOther != "" {
http.Redirect(w, r, res.SeeOther, http.StatusSeeOther) http.Redirect(w, r, res.SeeOther, http.StatusSeeOther)
flash := res.Session.FlashPeek() if res.Session != nil {
if flash != nil { flash := res.Session.FlashPeek()
err := json.NewEncoder(w).Encode(flash) if flash != nil {
if err != nil { err := json.NewEncoder(w).Encode(flash)
return err if err != nil {
return err
}
} }
} }
return nil return nil