From 5ca56b68734ad1e6411721259dfb1da4cc25ff9a Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 7 Feb 2018 01:16:14 -0500 Subject: [PATCH] Handle situation where nodes have no `loc` (like in tests) --- modules/osm/intersection.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/osm/intersection.js b/modules/osm/intersection.js index 7f918a815..bb89efea3 100644 --- a/modules/osm/intersection.js +++ b/modules/osm/intersection.js @@ -345,9 +345,11 @@ export function osmIntersection(graph, startVertexId) { n2 = vgraph.entity(way.nodes[0]); } - var toLoc = geoVecInterp(n1.loc, n2.loc, 10); // extend 1000% - n2 = n2.move(toLoc); - vgraph = vgraph.replace(n2); + if (n1.loc && n2.loc) { + var toLoc = geoVecInterp(n1.loc, n2.loc, 10); // extend 1000% + n2 = n2.move(toLoc); + vgraph = vgraph.replace(n2); + } });