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;
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java	(revision 11167)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java	(revision 11168)
@@ -38,3 +38,11 @@
         }
     }
+
+    /**
+     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/13828">Bug #13828</a>.
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testTicket13828() {
+        new WMSLayer(new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png"));
+    }
 }
