kopia lustrzana https://github.com/JOSM/MapWithAI
If territories are throwing an NPE, don't try to continue
Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head
rodzic
3d24632f00
commit
8f25ef3786
|
@ -163,26 +163,25 @@ public class MapWithAISourceReader implements Closeable {
|
|||
Set<String> codes;
|
||||
try {
|
||||
codes = Territories.getKnownIso3166Codes();
|
||||
} catch (NullPointerException e) {
|
||||
// Fix JOSM-19420
|
||||
Territories.initializeInternalData();
|
||||
codes = Territories.getKnownIso3166Codes();
|
||||
}
|
||||
List<ImageryBounds> bounds = new ArrayList<>();
|
||||
for (Map.Entry<String, JsonValue> country : countries.asJsonObject().entrySet()) {
|
||||
if (codes.contains(country.getKey())) {
|
||||
GeoPropertyIndex<Boolean> geoPropertyIndex = Territories.getGeoPropertyIndex(country.getKey());
|
||||
if (geoPropertyIndex.getGeoProperty() instanceof DefaultGeoProperty) {
|
||||
DefaultGeoProperty prop = (DefaultGeoProperty) geoPropertyIndex.getGeoProperty();
|
||||
Rectangle2D areaBounds = prop.getArea().getBounds2D();
|
||||
ImageryBounds tmp = new ImageryBounds(bboxToBoundsString(new BBox(areaBounds.getMinX(),
|
||||
areaBounds.getMinY(), areaBounds.getMaxX(), areaBounds.getMaxY()), ","), ",");
|
||||
areaToShapes(prop.getArea()).forEach(tmp::addShape);
|
||||
bounds.add(tmp);
|
||||
List<ImageryBounds> bounds = new ArrayList<>();
|
||||
for (Map.Entry<String, JsonValue> country : countries.asJsonObject().entrySet()) {
|
||||
if (codes.contains(country.getKey())) {
|
||||
GeoPropertyIndex<Boolean> geoPropertyIndex = Territories.getGeoPropertyIndex(country.getKey());
|
||||
if (geoPropertyIndex.getGeoProperty() instanceof DefaultGeoProperty) {
|
||||
DefaultGeoProperty prop = (DefaultGeoProperty) geoPropertyIndex.getGeoProperty();
|
||||
Rectangle2D areaBounds = prop.getArea().getBounds2D();
|
||||
ImageryBounds tmp = new ImageryBounds(bboxToBoundsString(new BBox(areaBounds.getMinX(),
|
||||
areaBounds.getMinY(), areaBounds.getMaxX(), areaBounds.getMaxY()), ","), ",");
|
||||
areaToShapes(prop.getArea()).forEach(tmp::addShape);
|
||||
bounds.add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return bounds;
|
||||
} catch (NullPointerException e) {
|
||||
Logging.error(e);
|
||||
}
|
||||
return bounds;
|
||||
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue