diff --git a/DataExtractionOSM/src/net/osmand/data/Street.java b/DataExtractionOSM/src/net/osmand/data/Street.java index 63367249a9..91c4001318 100644 --- a/DataExtractionOSM/src/net/osmand/data/Street.java +++ b/DataExtractionOSM/src/net/osmand/data/Street.java @@ -17,7 +17,7 @@ import net.osmand.osm.OSMSettings.OSMTagKey; public class Street extends MapObject { private List buildings = new ArrayList(); - private List wayNodes = new ArrayList(); + private List wayNodes = null; private final City city; public Street(City city, String name){ @@ -52,8 +52,10 @@ public class Street extends MapObject { protected void calculateCenter(){ List nodes = new ArrayList(); - for(Way w : wayNodes){ - nodes.addAll(w.getNodes()); + if (wayNodes != null) { + for (Way w : wayNodes) { + nodes.addAll(w.getNodes()); + } } LatLon c = MapUtils.getWeightCenterForNodes(nodes); @@ -121,10 +123,10 @@ public class Street extends MapObject { } location = MapUtils.getWeightCenter(nodes); } - if(location == null || (wayNodes.isEmpty() && buildings.isEmpty())){ + if(location == null || ((wayNodes == null || wayNodes.isEmpty()) && buildings.isEmpty())){ city.unregisterStreet(name); } - if (wayNodes.size() > 0) { + if (wayNodes != null && wayNodes.size() > 0) { this.id = wayNodes.get(0).getId(); } else if(buildings.size() > 0){ this.id = buildings.get(0).getId();