Ticket #23603: 23603.patch

File 23603.patch, 923 bytes (added by GerdP, 2 years ago)

replace check for existence of key in map by null check

  • src/org/openstreetmap/josm/plugins/elevation/ElevationHelper.java

     
    7676        }
    7777
    7878        // no HGT, check for elevation data in GPX
    79         if (!wpt.attr.containsKey(HEIGHT_ATTRIBUTE)) {
     79        // Parse elevation from GPX data
     80        String height = wpt.getString(HEIGHT_ATTRIBUTE);
     81        if (height == null) {
    8082            // GPX has no elevation data :-(
    8183            return NO_ELEVATION;
    8284        }
    8385
    84         // Parse elevation from GPX data
    85         String height = wpt.getString(ElevationHelper.HEIGHT_ATTRIBUTE);
    8686        try {
    8787            return Double.parseDouble(height);
    8888        } catch (NumberFormatException e) {