Skip to content

Commit

Permalink
Fix #10 bug with missing session bag
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Feb 17, 2025
1 parent 47bde5f commit d8112e4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Form/AntispamField.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,16 @@ public function generate()
*/
protected function setSessionData()
{
System::getContainer()
->get('request_stack')->getSession()
->getBag('contao_frontend')
try {
$sessionBag = System::getContainer()
->get('request_stack')
->getSession()
->getBag('contao_frontend');
} catch (\Throwable) {
return;
}

$sessionBag
->set('rocksolid_antispam_' . $this->strId, array(
'names' => $this->names,
'values' => $this->values,
Expand Down

0 comments on commit d8112e4

Please sign in to comment.