Merge pull request #18286 from sunilpawar/ui_30
[civicrm-core.git] / ang / api4Explorer / Explorer.js
index 10ed8f61472680687f3315034ffdd5c26cd89f66..7c64b6e6671c9d1e39d974db47e59bce121fed48 100644 (file)
       }
       // Then lookup implicit links
       _.each(path, function(node) {
-        entity = _.find(links[entity], {alias: node}).entity;
+        var link = _.find(links[entity], {alias: node});
+        if (!link) {
+          return false;
+        }
+        entity = link.entity;
       });
       return entity;
     }
           $scope.debug = debugFormat(resp.data);
           $scope.result = [
             formatMeta(resp.data),
-            prettyPrintOne('(' + resp.data.values.length + ') ' + _.escape(JSON.stringify(resp.data.values, null, 2)), 'js', 1)
+            prettyPrintOne((_.isArray(resp.data.values) ? '(' + resp.data.values.length + ') ' : '') + _.escape(JSON.stringify(resp.data.values, null, 2)), 'js', 1)
           ];
         }, function(resp) {
           $scope.loading = false;