]> git.mxchange.org Git - friendica.git/commitdiff
Possibly fix a fatal error
authorMichael <heluecht@pirati.ca>
Wed, 29 Jul 2020 19:48:26 +0000 (19:48 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 29 Jul 2020 19:48:26 +0000 (19:48 +0000)
src/Model/Contact.php

index 6dbba6ed408fa4fed5163bcb39c8394f64e8bd12..855f90431c3fd3a88919ba48986d1e3c5b7906b9 100644 (file)
@@ -207,7 +207,12 @@ class Contact
                        if (empty($cid)) {
                                return [];
                        }
-                       return self::getById($cid, $fields);
+
+                       $contact = self::getById($cid, $fields);
+                       if (empty($contact)) {
+                               return [];
+                       }
+                       return $contact;
                }
 
                // Add internal fields
@@ -238,6 +243,10 @@ class Contact
                        $contact = DBA::selectFirst('contact', $fields, $condition, $options);
                }
                
+               if (!DBA::isResult($contact)) {
+                       return [];
+               }
+
                // Update the contact in the background if needed
                if ((($contact['updated'] < DateTimeFormat::utc('now -7 days')) || empty($contact['avatar'])) &&
                        in_array($contact['network'], Protocol::FEDERATED)) {