From d59c323fb9f4569059218bbed1fa8a0665e9e465 Mon Sep 17 00:00:00 2001 From: Alexander Kellner Date: Wed, 7 Feb 2024 15:28:55 +0100 Subject: [PATCH] [BUGFIX] Prevent exception on tracked links when user is deleted or disabled Fixes https://github.com/in2code-de/luxletter/issues/210 --- Classes/Domain/Service/LogService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Service/LogService.php b/Classes/Domain/Service/LogService.php index 9981ca8..6d84d5c 100644 --- a/Classes/Domain/Service/LogService.php +++ b/Classes/Domain/Service/LogService.php @@ -67,8 +67,10 @@ public function logNewsletterOpening(Newsletter $newsletter, User $user): void */ public function logLinkOpening(Link $link): void { - $this->logNewsletterOpening($link->getNewsletter(), $link->getUser()); - $this->log($link->getNewsletter(), $link->getUser(), Log::STATUS_LINKOPENING, ['target' => $link->getTarget()]); + if ($link->getUser() !== null) { + $this->logNewsletterOpening($link->getNewsletter(), $link->getUser()); + $this->log($link->getNewsletter(), $link->getUser(), Log::STATUS_LINKOPENING, ['target' => $link->getTarget()]); + } } /**