Changeset 18005 in josm for trunk/src/org


Ignore:
Timestamp:
2021-07-12T12:42:05+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #21103 - see #14605 - proper fix of IllegalStateException in AutoScaleAction

File:
1 edited

Legend:

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

    r17786 r18005  
    3939import org.openstreetmap.josm.gui.layer.Layer;
    4040import org.openstreetmap.josm.spi.preferences.Config;
    41 import org.openstreetmap.josm.tools.Logging;
    4241import org.openstreetmap.josm.tools.Shortcut;
    4342
     
    289288            return null;
    290289        }
    291         try {
    292             List<Layer> layers = LayerListDialog.getInstance().getModel().getSelectedLayers();
    293             if (!layers.isEmpty())
    294                 return layers.get(0);
    295         } catch (IllegalStateException e) {
    296             Logging.error(e);
    297         }
    298         return null;
     290        List<Layer> layers = LayerListDialog.getInstance().getModel().getSelectedLayers();
     291        return layers.isEmpty() ? null : layers.get(0);
    299292    }
    300293
     
    403396            break;
    404397        case LAYER:
    405             setEnabled(getFirstSelectedLayer() != null);
     398            setEnabled(map != null && getFirstSelectedLayer() != null);
    406399            break;
    407400        case CONFLICT:
Note: See TracChangeset for help on using the changeset viewer.