Adjust where the code is to avoid empty warning

Shifted the code to avoid:
PHP Warning:  Undefined array key "totalItems" in /home/friendicadev/friendica/src/Model/APContact.php on line 277
This commit is contained in:
RealKinetix 2021-07-14 13:46:38 -07:00
parent c1db1c980e
commit f16b1df83f

View file

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