diff --git a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php index c9b11ea71..95ab71d4b 100644 --- a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php +++ b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php @@ -25,6 +25,8 @@ class AccompanyingPeriodWorkEventListener public function prePersistAccompanyingPeriodWork(AccompanyingPeriodWork $work): void { - $work->addReferrer($this->security->getUser()); + if (null !== $this->security->getUser()) { + $work->addReferrer($this->security->getUser()); + } } }