Changeset 12401 in josm for trunk


Ignore:
Timestamp:
2017-06-12T00:11:39+02:00 (7 years ago)
Author:
Don-vip
Message:

see #14929 - fix NPE in unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterManager.java

    r12400 r12401  
    171171
    172172    private static Set<String> getTagValues(String key) {
    173         BBox bbox = Main.map.mapView.getState().getViewArea().getLatLonBoundsBox().toBBox();
    174173        DataSet ds = Main.getLayerManager().getEditDataSet();
    175174        Set<String> values = new TreeSet<>();
    176         Consumer<OsmPrimitive> consumer = o -> {
    177             String value = o.get(key);
    178             if (value != null) {
    179                 for (String v : value.split(";")) {
    180                     values.add(v);
     175        if (ds != null) {
     176            BBox bbox = Main.map.mapView.getState().getViewArea().getLatLonBoundsBox().toBBox();
     177            Consumer<OsmPrimitive> consumer = o -> {
     178                String value = o.get(key);
     179                if (value != null) {
     180                    for (String v : value.split(";")) {
     181                        values.add(v);
     182                    }
    181183                }
    182             }
    183         };
    184         ds.searchNodes(bbox).forEach(consumer);
    185         ds.searchWays(bbox).forEach(consumer);
    186         ds.searchRelations(bbox).forEach(consumer);
     184            };
     185            ds.searchNodes(bbox).forEach(consumer);
     186            ds.searchWays(bbox).forEach(consumer);
     187            ds.searchRelations(bbox).forEach(consumer);
     188        }
    187189        return values;
    188190    }
Note: See TracChangeset for help on using the changeset viewer.