diff --git a/extensions/likes/src/Listener/SendNotificationWhenPostIsLiked.php b/extensions/likes/src/Listener/SendNotificationWhenPostIsLiked.php index bb848f391..b687ff3e8 100755 --- a/extensions/likes/src/Listener/SendNotificationWhenPostIsLiked.php +++ b/extensions/likes/src/Listener/SendNotificationWhenPostIsLiked.php @@ -30,7 +30,7 @@ class SendNotificationWhenPostIsLiked public function handle(PostWasLiked $event) { - if ($event->post->user->id != $event->user->id) { + if ($event->post->user && $event->post->user->id != $event->user->id) { $this->notifications->sync( new PostLikedBlueprint($event->post, $event->user), [$event->post->user] diff --git a/extensions/likes/src/Listener/SendNotificationWhenPostIsUnliked.php b/extensions/likes/src/Listener/SendNotificationWhenPostIsUnliked.php index 981b3224b..78919d6a4 100755 --- a/extensions/likes/src/Listener/SendNotificationWhenPostIsUnliked.php +++ b/extensions/likes/src/Listener/SendNotificationWhenPostIsUnliked.php @@ -30,7 +30,7 @@ class SendNotificationWhenPostIsUnliked public function handle(PostWasUnliked $event) { - if ($event->post->user->id != $event->user->id) { + if ($event->post->user && $event->post->user->id != $event->user->id) { $this->notifications->sync( new PostLikedBlueprint($event->post, $event->user), []