From 6b69db1e3b16cc57c43cd0735ea62bb3b41247cc Mon Sep 17 00:00:00 2001 From: Niklas Forsdahl Date: Thu, 27 Jun 2024 16:06:32 +0300 Subject: [PATCH] Fix for UnitTest failure with new SessionGridFieldStateManager functionality --- src/Forms/GridField/GridState_Data.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Forms/GridField/GridState_Data.php b/src/Forms/GridField/GridState_Data.php index a0761a5d8..a8d16be3d 100644 --- a/src/Forms/GridField/GridState_Data.php +++ b/src/Forms/GridField/GridState_Data.php @@ -19,11 +19,11 @@ class GridState_Data */ protected $data; - protected GridState $state; + protected ?GridState $state; protected $defaults = []; - public function __construct($data = [], GridState $state = null) + public function __construct($data = [], ?GridState $state = null) { $this->data = $data; $this->state = $state; @@ -88,7 +88,7 @@ class GridState_Data public function storeData() { $stateManager = $this->getStateManager(); - if (ClassInfo::hasMethod($stateManager, 'storeState')) { + if (ClassInfo::hasMethod($stateManager, 'storeState') && $this->state) { $stateManager->storeState($this->state->getGridField(), $this->state->Value()); } }