]> git.mxchange.org Git - friendica-addons.git/commitdiff
SN import from timeline, check if there are posting before the foreach loop
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Sat, 16 Feb 2013 08:15:08 +0000 (09:15 +0100)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Sat, 16 Feb 2013 08:15:08 +0000 (09:15 +0100)
statusnet/statusnet.php

index f3678c805b6b157f83a531db2a8779f81b7b93ac..393bbfe53fba58e2286e3d4c5962650cfea88e7f 100755 (executable)
@@ -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);
 }