Browse code

Add response check, fixes #252

Frederic Hemberger authored on 28/10/2011 at 14:21:02
Showing 1 changed files
... ...
@@ -15,7 +15,8 @@ var github = (function(){
15 15
         , error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
16 16
         , success: function(data) {
17 17
           var repos = [];
18
-          for (var i = 0; i < data.repositories.length; i++){
18
+          if (!data || !data.repositories) { return; }
19
+          for (var i = 0; i < data.repositories.length; i++) {
19 20
             if (options.skip_forks && data.repositories[i].fork) { continue; }
20 21
             repos.push(data.repositories[i]);
21 22
           }
... ...
@@ -30,7 +31,7 @@ var github = (function(){
30 30
           if (options.count) { repos.splice(options.count); }
31 31
           render(options.target, repos);
32 32
         }
33
-      })
33
+      });
34 34
     }
35 35
   };
36 36
 })();