diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index b5ba7142b1..865dd71c24 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -124,11 +124,21 @@ class Messaging extends Action $recipients = \array_merge($recipients, $targets); } + if (empty($recipients)) { + Console::error('No valid recipients found.'); + return; + } + $fallback = $dbForProject->findOne('providers', [ Query::equal('enabled', [true]), Query::equal('type', [$recipients[0]->getAttribute('providerType')]), ]); + if ($fallback === false) { + Console::error('No fallback provider found.'); + return; + } + /** * @var array> $identifiers */