From c4ddb900a9001b2a4b33dd5970994d20b547c9e9 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Thu, 19 Mar 2020 07:11:02 -0600 Subject: [PATCH] Fix #66 (NPE) Signed-off-by: Taylor Smock --- .../data/validation/tests/StreetAddressOrder.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressOrder.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressOrder.java index c0e12f9..fce5b2b 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressOrder.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressOrder.java @@ -181,9 +181,12 @@ public class StreetAddressOrder extends Test { if (address instanceof OsmPrimitive && way instanceof Way) { Node centroid = getCentroid(address); WaySegment seg = Geometry.getClosestWaySegment((Way) way, (OsmPrimitive) address); - boolean right = Geometry.angleIsClockwise(seg.getFirstNode(), seg.getSecondNode(), centroid); - if (left != right) { - addressesToReturn.add(address); + if (seg.getFirstNode().getEastNorth() != null && seg.getSecondNode().getEastNorth() != null + && centroid.getEastNorth() != null) { + boolean right = Geometry.angleIsClockwise(seg.getFirstNode(), seg.getSecondNode(), centroid); + if (left != right) { + addressesToReturn.add(address); + } } } }