fix undefined split function exception

This commit is contained in:
Bilal Catic
2019-09-10 11:49:26 +02:00
parent 93fe5ee870
commit fbbc0952e3

View File

@@ -383,9 +383,10 @@ class Indexer {
const parsedPrice = parsePrice(price);
const locationArray = location.split(",");
const region = locationArray[0];
const municipality = locationArray[1];
const locationArray =
location && location.length > 0 ? location.split(",") : [];
const region = locationArray.length > 0 ? locationArray[0] : "";
const municipality = locationArray.length > 1 ? locationArray[1] : "";
const data = {
realEstateType: this.getCategoryId(realEstateType),