From 6256c4e48e156f42b5bd7fdaf8f0b64f0f4265bf Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 6 Jan 2013 14:00:34 -0800 Subject: [PATCH] invalid foreach --- facebook/facebook.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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)); + } + } } } }