From e5499d75db18cd93d1f4c8db5ecf9298e3ec255c Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 16 Feb 2013 09:20:02 +0100 Subject: [PATCH] Twitter import from timeline, check if there are posting before the foreach loop --- twitter/twitter.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index 0452db60..808768f8 100755 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -615,7 +615,8 @@ function twitter_fetchtimeline($a, $uid) { $items = $connection->get('statuses/user_timeline', $parameters); $posts = array_reverse($items); - foreach ($posts as $post) { + if (count($posts)) { + foreach ($posts as $post) { if ($post->id_str > $lastid) $lastid = $post->id_str; @@ -652,7 +653,8 @@ function twitter_fetchtimeline($a, $uid) { require_once('mod/item.php'); item_post($a); - } + } + } } set_pconfig($uid, 'twitter', 'lastid', $lastid); } -- 2.39.5