Changeset 11653 in josm for trunk/src


Ignore:
Timestamp:
2017-03-03T21:38:29+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #14437 - NPE at AbstractProjection.latlon2eastNorth with Tools => Add Node...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java

    r11553 r11653  
    169169
    170170    public void setCoordinates(LatLon ll) {
    171         latLonCoordinates = Optional.ofNullable(ll).orElse(LatLon.ZERO);
    172         tfLatLon.setText(latLonCoordinates.latToString(CoordinateFormat.getDefaultFormat()) + ' ' +
    173                          latLonCoordinates.lonToString(CoordinateFormat.getDefaultFormat()));
    174         EastNorth en = Main.getProjection().latlon2eastNorth(latLonCoordinates);
     171        LatLon llc = Optional.ofNullable(ll).orElse(LatLon.ZERO);
     172        tfLatLon.setText(llc.latToString(CoordinateFormat.getDefaultFormat()) + ' ' +
     173                         llc.lonToString(CoordinateFormat.getDefaultFormat()));
     174        EastNorth en = Main.getProjection().latlon2eastNorth(llc);
    175175        tfEastNorth.setText(Double.toString(en.east()) + ' ' + Double.toString(en.north()));
     176        // Both latLonCoordinates and eastNorthCoordinates may have been reset to null if ll is out of the world
     177        latLonCoordinates = llc;
     178        eastNorthCoordinates = en;
    176179        setOkEnabled(true);
    177180    }
Note: See TracChangeset for help on using the changeset viewer.