From 7241be1df114fb22f089035eef403d7211c836ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Thu, 1 Jun 2023 13:20:50 +0300 Subject: [PATCH] ensure users is not empty --- app/Listeners/Email/SendInvalidEmailNotification.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Listeners/Email/SendInvalidEmailNotification.php b/app/Listeners/Email/SendInvalidEmailNotification.php index 2ad5e82fe3b..46e897c1096 100644 --- a/app/Listeners/Email/SendInvalidEmailNotification.php +++ b/app/Listeners/Email/SendInvalidEmailNotification.php @@ -10,7 +10,11 @@ class SendInvalidEmailNotification { public function handle(Event $event): void { - $users = company()->users; + $users = company()?->users; + + if (empty($users)) { + return; + } $this->notifyAdminsAboutInvalidContactEmail($event, $users);