]> git.mxchange.org Git - friendica.git/commitdiff
Adjust where the code is to avoid empty warning
authorRealKinetix <kinetix@isurf.ca>
Wed, 14 Jul 2021 20:46:38 +0000 (13:46 -0700)
committerRealKinetix <kinetix@isurf.ca>
Wed, 14 Jul 2021 20:46:38 +0000 (13:46 -0700)
Shifted the code to avoid:
PHP Warning:  Undefined array key "totalItems" in /home/friendicadev/friendica/src/Model/APContact.php on line 277

src/Model/APContact.php

index eb34e502ec169aabf7150b6315ae96c2004f8067..64f45a8451869f5f08a6deaca23c3bd14465dd22 100644 (file)
@@ -272,12 +272,12 @@ class APContact
 
                if (!empty($apcontact['followers'])) {
                        $followers = ActivityPub::fetchContent($apcontact['followers']);
-                       // Mastodon seriously allows for this condition? 
-                       // Jul 14 2021 - See https://mastodon.online/@goes11 for a negative followers count
-                       if ($followers['totalItems'] < 0) {
-                               $followers['totalItems'] = 0;
-                       }
                        if (!empty($followers['totalItems'])) {
+                               // Mastodon seriously allows for this condition? 
+                               // Jul 14 2021 - See https://mastodon.online/@goes11 for a negative followers count
+                               if ($followers['totalItems'] < 0) {
+                                       $followers['totalItems'] = 0;
+                               }
                                $apcontact['followers_count'] = $followers['totalItems'];
                        }
                }