Changeset 11186 in josm for trunk


Ignore:
Timestamp:
2016-10-29T13:57:27+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #13859 - NPE

File:
1 edited

Legend:

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

    r11088 r11186  
    252252
    253253        private void updateOffsetIntl() {
    254             // Support projections with very small numbers (e.g. 4326)
    255             int precision = Main.getProjection().getDefaultZoomInPPD() >= 1.0 ? 2 : 7;
    256             // US locale to force decimal separator to be '.'
    257             try (Formatter us = new Formatter(Locale.US)) {
    258                 TileSourceDisplaySettings ds = layer.getDisplaySettings();
    259                 tOffset.setText(us.format(new StringBuilder()
    260                     .append("%1.").append(precision).append("f; %1.").append(precision).append('f').toString(),
    261                     ds.getDx(), ds.getDy()).toString());
     254            if (layer != null) {
     255                // Support projections with very small numbers (e.g. 4326)
     256                int precision = Main.getProjection().getDefaultZoomInPPD() >= 1.0 ? 2 : 7;
     257                // US locale to force decimal separator to be '.'
     258                try (Formatter us = new Formatter(Locale.US)) {
     259                    TileSourceDisplaySettings ds = layer.getDisplaySettings();
     260                    tOffset.setText(us.format(new StringBuilder()
     261                        .append("%1.").append(precision).append("f; %1.").append(precision).append('f').toString(),
     262                        ds.getDx(), ds.getDy()).toString());
     263                }
    262264            }
    263265        }
Note: See TracChangeset for help on using the changeset viewer.