Skip to content

Commit

Permalink
[aggConfigs] harden #getResponseAggById()
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer Alger committed Jan 9, 2015
1 parent f9ee0b2 commit 7cbc474
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/kibana/components/vis/_agg_configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ define(function (require) {
* @return {AggConfig}
*/
AggConfigs.prototype.getResponseAggById = function (id) {
id = String(id);
var reqAgg = _.find(this.getRequestAggs(), function (agg) {
return id.substr(0, agg.id.length) === agg.id;
return id.substr(0, String(agg.id).length) === agg.id;
});
if (!reqAgg) return;
return _.find(reqAgg.getResponseAggs(), { id: id });
};

Expand Down

0 comments on commit 7cbc474

Please sign in to comment.