fix: check if flash field exists

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

View File

@ -18,7 +18,11 @@ func (s *Session) FlashGet() any {
}
func (s *Session) FlashPeek() any {
list, _ := s.inner.Values["_flash"].([]any)
flash, ok := s.inner.Values["_flash"]
if !ok {
return nil
}
list := flash.([]any)
if len(list) < 1 {
return nil
} else {