Changeset 33978 in osm for applications


Ignore:
Timestamp:
2018-01-07T00:35:51+01:00 (7 years ago)
Author:
donvip
Message:

fix #josm15736 - robustness against null API capabilities

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/DataSetUpdater.java

    r33611 r33978  
    1919import org.openstreetmap.josm.data.osm.Relation;
    2020import org.openstreetmap.josm.data.osm.Way;
     21import org.openstreetmap.josm.io.Capabilities;
    2122import org.openstreetmap.josm.io.OsmApi;
    2223import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
     
    4849            }
    4950            // Split ways exceeding 90% of the API limit (currently 2000 nodes)
    50             int max = (int) (0.9 * OsmApi.getOsmApi().getCapabilities().getMaxWayNodes());
     51            Capabilities capabilities = OsmApi.getOsmApi().getCapabilities();
     52            long maxwaynodes = capabilities != null ? capabilities.getMaxWayNodes() : 2000L;
     53            int max = (int) (0.9 * maxwaynodes);
    5154            for (Way w : dataSet.getWays().stream()
    5255                    .filter(w -> w.getNodesCount() > max)
Note: See TracChangeset for help on using the changeset viewer.