- fixes error on returned type not matching
// Default is 'null'
$stateName = 'null';
- // Get the state instance
- $stateInstance = $this->getStateInstance();
+ // Check if state instance is there
+ if ($this->isStateInstanceSet()) {
+ // Get the state instance
+ $stateInstance = $this->getStateInstance();
+ }
// Is it an instance of Stateable?
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: stateInstance[]=%s', gettype($stateInstance)));