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

index 0452db60360876306ed31ac4b82fb7fb1c284db6..808768f8305bbefccfcf8b9750e935c582ca5b6a 100755 (executable)
@@ -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);
 }