From 8fd5a336af2ec5f0da869b324e25ca03ad171191 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 19 Jan 2024 20:18:10 +1300 Subject: [PATCH] Make sure target exists before updating --- src/Appwrite/Platform/Workers/Messaging.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index e95d7835fd..a5c8154b91 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -247,11 +247,13 @@ class Messaging extends Action Query::equal('identifier', [$detail['recipient']]) ]); - $dbForProject->updateDocument( - 'targets', - $target->getId(), - $target->setAttribute('expired', true) - ); + if ($target instanceof Document && !$target->isEmpty()) { + $dbForProject->updateDocument( + 'targets', + $target->getId(), + $target->setAttribute('expired', true) + ); + } } } } catch (\Exception $e) {