Skip to content

Commit

Permalink
add null check when line matching
Browse files Browse the repository at this point in the history
  • Loading branch information
indraneel committed Aug 21, 2019
1 parent 74971cf commit 9c68045
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/models/SharedStreets/SharedStreetsMatchGeomFeatureCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ export class SharedStreetsMatchGeomFeatureCollection implements FeatureCollectio


public addFeaturesFromGeojson(newFeatures: Feature[]) {
const newFeaturesArray: Array<SharedStreetsMatchGeomPath | SharedStreetsMatchGeomPoint> = newFeatures.map((feature: Feature) => {
if (feature.geometry.type === "Point") {
const point = new SharedStreetsMatchGeomPoint(feature);
return point;
}
else {
const path = new SharedStreetsMatchGeomPath(feature);
return path;
}
});
this.features = this.features.concat(newFeaturesArray);
if (newFeatures && newFeatures.length > 0) {
const newFeaturesArray: Array<SharedStreetsMatchGeomPath | SharedStreetsMatchGeomPoint> = newFeatures.map((feature: Feature) => {
if (feature.geometry.type === "Point") {
const point = new SharedStreetsMatchGeomPoint(feature);
return point;
}
else {
const path = new SharedStreetsMatchGeomPath(feature);
return path;
}
});
this.features = this.features.concat(newFeaturesArray);
}
}
}

0 comments on commit 9c68045

Please sign in to comment.