diff --git a/Neos.Flow/Classes/Mvc/FlashMessage/Storage/FlashMessageSessionStorage.php b/Neos.Flow/Classes/Mvc/FlashMessage/Storage/FlashMessageSessionStorage.php
index <HASH>..<HASH> 100644
--- a/Neos.Flow/Classes/Mvc/FlashMessage/Storage/FlashMessageSessionStorage.php
+++ b/Neos.Flow/Classes/Mvc/FlashMessage/Storage/FlashMessageSessionStorage.php
@@ -83,7 +83,10 @@ class FlashMessageSessionStorage implements FlashMessageStorageInterface
         }
         /** @var FlashMessageContainer $flashMessageContainer */
         $flashMessageContainer = $this->session->getData($this->sessionKey);
-        return $flashMessageContainer;
+        if ($flashMessageContainer instanceof FlashMessageContainer) {
+            return $flashMessageContainer;
+        }
+        return null;
     }
 
     /**
BUGFIX: Avoid bool return value in restoreFlashMessageContainerFromSession()

It can happen, that `getData(…)` returns a boolean, leading to an error

due to the return type declaration.