Skip to content

Commit d048b92

Browse files
committed
Fix null error in weird code fragment
1 parent 6ab22f4 commit d048b92

File tree

1 file changed

+3
-8
lines changed
  • web-bundle/src/main/resources/com/graphhopper/maps/js

1 file changed

+3
-8
lines changed

web-bundle/src/main/resources/com/graphhopper/maps/js/map.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,10 @@ function sliceFeatureCollection(detail, detailKey, geoJsonFeature){
420420
// It's important to +1
421421
// Array.slice is exclusive the to element and the feature needs to include the to coordinate
422422
var to = detailObj[1] + 1;
423-
var value;
424-
try {
425-
value = detailObj[2].toString()
426-
} catch (error) {
427-
console.error(error);
423+
var value = detailObj[2];
424+
if (typeof value === "undefined" || value === null)
428425
value = "Undefined";
429-
}
430-
431-
var tmpPoints = points.slice(from,to);
426+
var tmpPoints = points.slice(from, to);
432427

433428
feature.features.push({
434429
"type": "Feature",

0 commit comments

Comments
 (0)