From: friendica Date: Sun, 6 Jan 2013 22:00:34 +0000 (-0800) Subject: invalid foreach X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6256c4e48e156f42b5bd7fdaf8f0b64f0f4265bf;p=friendica-addons.git invalid foreach --- diff --git a/facebook/facebook.php b/facebook/facebook.php index f977bef9..4c1c0a14 100644 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -383,10 +383,12 @@ function fb_get_friends_sync_full($uid, $access_token, $persons) { if($s) { $results = json_decode($s); logger('fb_get_friends: info: ' . print_r($results,true), LOGGER_DATA); - foreach ($results as $contact) { - if ($contact->code != 200) logger('fb_get_friends: not found: ' . print_r($contact,true), LOGGER_DEBUG); - else fb_get_friends_sync_parsecontact($uid, json_decode($contact->body)); - } + if(count($results)) { + foreach ($results as $contact) { + if ($contact->code != 200) logger('fb_get_friends: not found: ' . print_r($contact,true), LOGGER_DEBUG); + else fb_get_friends_sync_parsecontact($uid, json_decode($contact->body)); + } + } } } }