Skip to content

Commit

Permalink
Make sure index pattern has fields before parsing (#58242) (#58265)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Caldwell authored Feb 21, 2020
1 parent 369004b commit 8fa101a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ function getUniqueLayerCounts(layerCountsList: ILayerTypeCount[], mapsCount: num
}

function getIndexPatternsWithGeoFieldCount(indexPatterns: IIndexPattern[]) {
const fieldLists = indexPatterns.map(indexPattern => JSON.parse(indexPattern.attributes.fields));
const fieldLists = indexPatterns.map(indexPattern =>
indexPattern.attributes && indexPattern.attributes.fields
? JSON.parse(indexPattern.attributes.fields)
: []
);
const fieldListsWithGeoFields = fieldLists.filter(fields =>
fields.some(
(field: IFieldType) =>
Expand Down

0 comments on commit 8fa101a

Please sign in to comment.