Changeset 6333 in josm


Ignore:
Timestamp:
2013-10-27T03:20:19+01:00 (8 years ago)
Author:
Don-vip
Message:

fix #9189 - NPE when deleting data layer + additional usage of Main.isDisplayingMapView()

Location:
trunk/src/org/openstreetmap/josm
Files:
9 edited

Legend:

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

    r6316 r6333  
    363363        if (map != null) {
    364364            map.mapView.removeLayer(layer);
    365             if (map.mapView.getAllLayers().isEmpty()) {
     365            if (isDisplayingMapView() && map.mapView.getAllLayers().isEmpty()) {
    366366                setMapFrame(null);
    367367            }
  • trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java

    r6289 r6333  
    261261            setEnabled(getCurrentDataSet() != null && ! getCurrentDataSet().getSelected().isEmpty());
    262262        }  else if ("layer".equals(mode)) {
    263             if (Main.map == null || Main.map.mapView == null || Main.map.mapView.getAllLayersAsList().isEmpty()) {
     263            if (!Main.isDisplayingMapView() || Main.map.mapView.getAllLayersAsList().isEmpty()) {
    264264                setEnabled(false);
    265265            } else {
  • trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java

    r5799 r6333  
    3939    public static Set<RelationMember> getMembersForCurrentSelection(Relation r) {
    4040        Set<RelationMember> members = new HashSet<RelationMember>();
    41         if (Main.map != null && Main.map.mapView != null) {
     41        if (Main.isDisplayingMapView()) {
    4242            OsmDataLayer editLayer = Main.map.mapView.getEditLayer();
    4343            if (editLayer != null && editLayer.data != null) {
  • trunk/src/org/openstreetmap/josm/command/Command.java

    r6173 r6333  
    8686     */
    8787    public Command() {
    88         this.layer = Main.map != null && Main.map.mapView != null ? Main.map.mapView.getEditLayer() : null;
     88        this.layer = Main.isDisplayingMapView() ? Main.map.mapView.getEditLayer() : null;
    8989    }
    9090
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r6316 r6333  
    407407        }
    408408        // repaint to make sure new data is displayed properly.
    409         if (Main.map != null && Main.map.mapView != null) {
     409        if (Main.isDisplayingMapView()) {
    410410            Main.map.mapView.repaint();
    411411        }
  • trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java

    r6070 r6333  
    156156    @Override
    157157    public void layerRemoved(Layer oldLayer) {
    158         if (oldLayer instanceof OsmDataLayer && Main.map != null && Main.map.mapView.getEditLayer() == null) {
     158        if (oldLayer instanceof OsmDataLayer && Main.isDisplayingMapView() && Main.map.mapView.getEditLayer() == null) {
    159159            Main.main.removeLayer(this);
    160160        } else if (oldLayer == this) {
  • trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java

    r6313 r6333  
    604604            if (request.getState() != null && !request.isPrecacheOnly()) {
    605605                finishedRequests.add(request);
    606                 if (Main.map != null && Main.map.mapView != null) {
     606                if (Main.isDisplayingMapView()) {
    607607                    Main.map.mapView.repaint();
    608608                }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java

    r6316 r6333  
    8484        Node nd = null;
    8585
    86         if (Main.map != null &&  Main.map.mapView != null) {
     86        if (Main.isDisplayingMapView()) {
    8787            Point p = Main.map.mapView.getPoint(ll);
    8888            nd = Main.map.mapView.getNearestNode(p, OsmPrimitive.isUsablePredicate);
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java

    r6316 r6333  
    115115        Node nd = null;
    116116
    117         if (Main.map != null && Main.map.mapView != null) {
     117        if (Main.isDisplayingMapView()) {
    118118            Point p = Main.map.mapView.getPoint(ll);
    119119            nd = Main.map.mapView.getNearestNode(p, OsmPrimitive.isUsablePredicate);
Note: See TracChangeset for help on using the changeset viewer.