From 8e6d1d8f8be6480f0816c7dc04b8a9ff5ad1670d Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 16 Feb 2013 09:15:08 +0100 Subject: [PATCH] SN import from timeline, check if there are posting before the foreach loop --- statusnet/statusnet.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index f3678c80..393bbfe5 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -808,7 +808,8 @@ function statusnet_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 > $lastid) $lastid = $post->id; @@ -852,7 +853,8 @@ function statusnet_fetchtimeline($a, $uid) { require_once('mod/item.php'); item_post($a); } - } + } + } } set_pconfig($uid, 'statusnet', 'lastid', $lastid); }