Skip to content
This repository was archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
fix: check undefined variables
Browse files Browse the repository at this point in the history
  • Loading branch information
legal-s committed Nov 19, 2015
1 parent 0e35855 commit d9d49e4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions kendo-elasticsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@
// We do not use the native 'fields' due to this bug:
// https://github.com/elastic/elasticsearch/issues/14475
function getValuesFromSource(source, pathParts) {
var values;
var values = [];
var value = source[pathParts[0]];
if (value === undefined) {
return [];
Expand Down Expand Up @@ -795,10 +795,12 @@
}).forEach(function(fieldKey) {
var field = fields[fieldKey];
var values = getValuesFromSource(hitSource, field.esNameSplit);
if (field.esMultiSplit) {
dataItem[fieldKey] = values;
} else {
dataItem[fieldKey] = values.join(field.esMultiSeparator || ";");
if(values){
if (field.esMultiSplit) {
dataItem[fieldKey] = values;
} else {
dataItem[fieldKey] = values.join(field.esMultiSeparator || ";");
}
}
});

Expand Down

0 comments on commit d9d49e4

Please sign in to comment.