github: Fix `GithubAPI::load_repo_branches`
authorAlexandre Terrasa <alexandre@moz-code.org>
Wed, 19 Jun 2019 02:39:58 +0000 (22:39 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Wed, 3 Jul 2019 03:17:48 +0000 (23:17 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/github/api.nit

index 4eb9a97..1cb3249 100644 (file)
@@ -201,8 +201,12 @@ class GithubAPI
                var res = new Array[Branch]
                if not array isa JsonArray then return res
                var deser = deserialize(array.to_json)
-               if deser isa Array[Object] then return res # empty array
-               return deser.as(Array[Branch])
+               if not deser isa Array[Object] then return res # empty array
+               for branch in deser do
+                       if not branch isa Branch then continue
+                       res.add branch
+               end
+               return res
        end
 
        # List of issues associated with their ids.