diff src/facebook.coffee @ 27:f27ddfa42e94

try/catch; From/To/-ESN changes; google probs
author Mathias Gebbe <mgebbe@intevation.de>
date Sat, 28 Jun 2014 13:08:40 +0200
parents 08d9679da0f7
children 3e3fa35e3ce2
line wrap: on
line diff
--- a/src/facebook.coffee	Tue Jun 24 08:32:51 2014 +0200
+++ b/src/facebook.coffee	Sat Jun 28 13:08:40 2014 +0200
@@ -336,13 +336,16 @@
       callback null, null
 
     newposts = new Array()
-    async.each res.data, ((post,cb) ->
-      newposts.push(post) if (post.type is 'status' or post.type is 'photo' or post.type is 'link' or post.type is 'video') and (post.status_type is 'mobile_status_update' or post.status_type is 'added_photos' or post.status_type is 'shared_story')
-      cb()
-      return
-    ), (err) ->
-      callback null, newposts.reverse()
-      return
+
+    if res.data?
+      async.each res.data, ((post,cb) ->
+        if (post.type is 'status' or post.type is 'photo' or post.type is 'link' or post.type is 'video') and (post.status_type is 'mobile_status_update' or post.status_type is 'added_photos' or post.status_type is 'shared_story')
+          newposts.push(post)
+        cb()
+      ), (err) ->
+        callback null, newposts.reverse()
+    else
+      callback null,null
   return
 
 #######################################
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)