MDL-64632 core_message: fixed PHP error when users are deleted from DB
[moodle.git] / message / classes / api.php
index 0b583e7..be8aea6 100644 (file)
@@ -691,6 +691,10 @@ class api {
             // Don't use array_merge, as we lose array keys.
             $memberinfo = $individualmemberinfo + $groupmemberinfo;
 
+            if (empty($memberinfo)) {
+                return [];
+            }
+
             // Update the members array with the member information.
             $deletedmembers = [];
             foreach ($members as $convid => $memberarr) {