Changeset 6831 in josm for trunk


Ignore:
Timestamp:
2014-02-10T12:07:07+01:00 (11 years ago)
Author:
akks
Message:

fix #9703: key>value in search or filter gave NPE for non-existing key

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java

    r6798 r6831  
    538538        public boolean match(OsmPrimitive osm) {
    539539            int compareResult;
     540            String currentValue = osm.get(key);
     541            if (currentValue == null) return false;
    540542            try {
    541543                compareResult = Double.compare(
    542                         Double.parseDouble(osm.get(key)),
     544                        Double.parseDouble(currentValue),
    543545                        Double.parseDouble(referenceValue)
    544546                );
    545             } catch (Exception ignore) {
     547            } catch (NumberFormatException ignore) {
    546548                compareResult = osm.get(key).compareTo(referenceValue);
    547549            }
Note: See TracChangeset for help on using the changeset viewer.