Index: trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 11167)
+++ trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 11168)
@@ -30,4 +30,5 @@
 import org.openstreetmap.josm.gui.ExtendedDialog;
 import org.openstreetmap.josm.gui.layer.imagery.TileSourceDisplaySettings;
+import org.openstreetmap.josm.tools.CheckParameterUtil;
 
 /**
@@ -61,4 +62,7 @@
     public WMSLayer(ImageryInfo info) {
         super(info);
+        CheckParameterUtil.ensureThat(info.getImageryType() == ImageryType.WMS, "ImageryType is WMS");
+        CheckParameterUtil.ensureParameterNotNull(info.getUrl(), "info.url");
+        TemplatedWMSTileSource.checkUrl(info.getUrl());
         this.supportedProjections = new TreeSet<>(info.getServerProjections());
     }
@@ -82,11 +86,7 @@
     @Override
     protected AbstractWMSTileSource getTileSource() {
-        if (info.getImageryType() == ImageryType.WMS && info.getUrl() != null) {
-            TemplatedWMSTileSource.checkUrl(info.getUrl());
-            AbstractWMSTileSource tileSource = new TemplatedWMSTileSource(info);
-            info.setAttribution(tileSource);
-            return tileSource;
-        }
-        return null;
+        AbstractWMSTileSource tileSource = new TemplatedWMSTileSource(info);
+        info.setAttribution(tileSource);
+        return tileSource;
     }
 
