Index: trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- trunk/src/org/openstreetmap/josm/Main.java	(revision 6332)
+++ trunk/src/org/openstreetmap/josm/Main.java	(revision 6333)
@@ -363,5 +363,5 @@
         if (map != null) {
             map.mapView.removeLayer(layer);
-            if (map.mapView.getAllLayers().isEmpty()) {
+            if (isDisplayingMapView() && map.mapView.getAllLayers().isEmpty()) {
                 setMapFrame(null);
             }
Index: trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 6332)
+++ trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 6333)
@@ -261,5 +261,5 @@
             setEnabled(getCurrentDataSet() != null && ! getCurrentDataSet().getSelected().isEmpty());
         }  else if ("layer".equals(mode)) {
-            if (Main.map == null || Main.map.mapView == null || Main.map.mapView.getAllLayersAsList().isEmpty()) {
+            if (!Main.isDisplayingMapView() || Main.map.mapView.getAllLayersAsList().isEmpty()) {
                 setEnabled(false);
             } else {
Index: trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java	(revision 6332)
+++ trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java	(revision 6333)
@@ -39,5 +39,5 @@
     public static Set<RelationMember> getMembersForCurrentSelection(Relation r) {
         Set<RelationMember> members = new HashSet<RelationMember>();
-        if (Main.map != null && Main.map.mapView != null) {
+        if (Main.isDisplayingMapView()) {
             OsmDataLayer editLayer = Main.map.mapView.getEditLayer();
             if (editLayer != null && editLayer.data != null) {
Index: trunk/src/org/openstreetmap/josm/command/Command.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/Command.java	(revision 6332)
+++ trunk/src/org/openstreetmap/josm/command/Command.java	(revision 6333)
@@ -86,5 +86,5 @@
      */
     public Command() {
-        this.layer = Main.map != null && Main.map.mapView != null ? Main.map.mapView.getEditLayer() : null;
+        this.layer = Main.isDisplayingMapView() ? Main.map.mapView.getEditLayer() : null;
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 6332)
+++ trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 6333)
@@ -407,5 +407,5 @@
         }
         // repaint to make sure new data is displayed properly.
-        if (Main.map != null && Main.map.mapView != null) {
+        if (Main.isDisplayingMapView()) {
             Main.map.mapView.repaint();
         }
Index: trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java	(revision 6332)
+++ trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java	(revision 6333)
@@ -156,5 +156,5 @@
     @Override
     public void layerRemoved(Layer oldLayer) {
-        if (oldLayer instanceof OsmDataLayer && Main.map != null && Main.map.mapView.getEditLayer() == null) {
+        if (oldLayer instanceof OsmDataLayer && Main.isDisplayingMapView() && Main.map.mapView.getEditLayer() == null) {
             Main.main.removeLayer(this);
         } else if (oldLayer == this) {
Index: trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 6332)
+++ trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 6333)
@@ -604,5 +604,5 @@
             if (request.getState() != null && !request.isPrecacheOnly()) {
                 finishedRequests.add(request);
-                if (Main.map != null && Main.map.mapView != null) {
+                if (Main.isDisplayingMapView()) {
                     Main.map.mapView.repaint();
                 }
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java	(revision 6332)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java	(revision 6333)
@@ -84,5 +84,5 @@
         Node nd = null;
 
-        if (Main.map != null &&  Main.map.mapView != null) {
+        if (Main.isDisplayingMapView()) {
             Point p = Main.map.mapView.getPoint(ll);
             nd = Main.map.mapView.getNearestNode(p, OsmPrimitive.isUsablePredicate);
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 6332)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 6333)
@@ -115,5 +115,5 @@
         Node nd = null;
 
-        if (Main.map != null && Main.map.mapView != null) {
+        if (Main.isDisplayingMapView()) {
             Point p = Main.map.mapView.getPoint(ll);
             nd = Main.map.mapView.getNearestNode(p, OsmPrimitive.isUsablePredicate);
