Index: trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 5556)
+++ trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 5557)
@@ -600,5 +600,7 @@
             if (request.getState() != null && !request.isPrecacheOnly()) {
                 finishedRequests.add(request);
-                Main.map.mapView.repaint();
+                if (Main.map != null && Main.map.mapView != null) {
+                    Main.map.mapView.repaint();
+                }
             }
         } finally {
