Index: /trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java	(revision 8067)
+++ /trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java	(revision 8068)
@@ -187,6 +187,10 @@
                 // Just set the URL and hope everything works out
                 if(s.wmsUrl.isEmpty()) {
-                    addWMSLayer(s.name + " (" + text + ")", text);
-                    break outer;
+                    try {
+                        addWMSLayer(s.name + " (" + text + ")", text);
+                        break outer;
+                    } catch (IllegalStateException ex) {
+                        Main.error(ex.getMessage());
+                    }
                 }
 
@@ -226,7 +230,11 @@
      * @param title Name of the layer as it will shop up in the layer manager
      * @param url URL to the WMS server
+     * @throws IllegalStateException if imagery time is neither HTML nor WMS
+     * @see WMSLayer#checkGrabberType
      */
     private void addWMSLayer(String title, String url) {
-        Main.main.addLayer(new WMSLayer(new ImageryInfo(title, url)));
+        WMSLayer layer = new WMSLayer(new ImageryInfo(title, url));
+        layer.checkGrabberType();
+        Main.main.addLayer(layer);
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 8067)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 8068)
@@ -1021,10 +1021,21 @@
     }
 
+    /**
+     * Checks that WMS layer is a grabber-compatible one (HTML or WMS).
+     * @throws IllegalStateException if imagery time is neither HTML nor WMS
+     * @since 8068
+     */
+    public void checkGrabberType() {
+        ImageryType it = getInfo().getImageryType();
+        if (!ImageryType.HTML.equals(it) && !ImageryType.WMS.equals(it))
+            throw new IllegalStateException("getGrabber() called for non-WMS layer type");
+    }
+
     protected WMSGrabber getGrabber(boolean localOnly) {
+        checkGrabberType();
         if (getInfo().getImageryType() == ImageryType.HTML)
             return new HTMLGrabber(Main.map.mapView, this, localOnly);
-        else if (getInfo().getImageryType() == ImageryType.WMS)
+        else
             return new WMSGrabber(Main.map.mapView, this, localOnly);
-        else throw new IllegalStateException("getGrabber() called for non-WMS layer type");
     }
 
