Compare commits

...

2 Commits

Author SHA1 Message Date
Maxime Rainville 8e3f71afb7
Merge pull request #85 from creative-commoners/pulls/2.4/null-state
FIX Handle invalid json data
2023-01-26 13:15:33 +13:00
Steve Boyd fe5e87598f FIX Handle invalid json data 2023-01-24 14:38:01 +13:00
1 changed files with 4 additions and 1 deletions

View File

@ -529,7 +529,10 @@ class TestSessionEnvironment
public function getState()
{
$path = Director::getAbsFile($this->getFilePath());
return (file_exists($path ?? '')) ? json_decode(file_get_contents($path)) : new stdClass;
if (file_exists($path ?? '')) {
return json_decode(file_get_contents($path)) ?: new stdClass;
}
return new stdClass;
}
/**