Index: /trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java	(revision 13386)
+++ /trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java	(revision 13387)
@@ -720,9 +720,11 @@
     @Override
     public int getTileSize() {
-        // no support for non-square tiles (tileHeight != tileWidth)
-        // and for different tile sizes at different zoom levels
-        Collection<Layer> projLayers = getLayers(null, tileProjection.toCode());
-        if (!projLayers.isEmpty()) {
-            return projLayers.iterator().next().tileMatrixSet.tileMatrix.get(0).tileHeight;
+        if (tileProjection != null) {
+            // no support for non-square tiles (tileHeight != tileWidth)
+            // and for different tile sizes at different zoom levels
+            Collection<Layer> projLayers = getLayers(null, tileProjection.toCode());
+            if (!projLayers.isEmpty()) {
+                return projLayers.iterator().next().tileMatrixSet.tileMatrix.get(0).tileHeight;
+            }
         }
         // if no layers is found, fallback to default mercator tile size. Maybe it will work
@@ -1059,5 +1061,5 @@
     @Override
     public String getServerCRS() {
-        return tileProjection.toCode();
+        return tileProjection != null ? tileProjection.toCode() : null;
     }
 }
Index: /trunk/src/org/openstreetmap/josm/gui/MapViewState.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/MapViewState.java	(revision 13386)
+++ /trunk/src/org/openstreetmap/josm/gui/MapViewState.java	(revision 13387)
@@ -159,4 +159,13 @@
     }
 
+    @Override
+    public String toString() {
+        return getClass().getName() + " [projecting=" + this.projecting
+            + " viewWidth=" + this.viewWidth
+            + " viewHeight=" + this.viewHeight
+            + " scale=" + this.scale
+            + " topLeft=" + this.topLeft + ']';
+    }
+
     /**
      * The scale in east/north units per pixel.
@@ -762,5 +771,9 @@
             return null;
         }
-    }
-
+
+        @Override
+        public String toString() {
+            return "MapViewRectangle [p1=" + p1 + ", p2=" + p2 + ']';
+        }
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 13386)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 13387)
@@ -1418,4 +1418,7 @@
         if (coordinateConverter.requiresReprojection()) {
             Projection projServer = Projections.getProjectionByCode(tileSource.getServerCRS());
+            if (projServer == null) {
+                throw new IllegalStateException(tileSource.toString());
+            }
             ProjectionBounds projBounds = new ProjectionBounds(
                     CoordinateConversion.projToEn(topLeftUnshifted),
@@ -1889,5 +1892,5 @@
             try {
                 drawInViewArea(graphics.getDefaultGraphics(), graphics.getMapView(), graphics.getClipBounds().getProjectionBounds());
-            } catch (IllegalArgumentException e) {
+            } catch (IllegalArgumentException | IllegalStateException e) {
                 throw BugReport.intercept(e)
                                .put("graphics", graphics).put("tileSource", tileSource).put("currentZoomLevel", currentZoomLevel);
Index: /trunk/src/org/openstreetmap/josm/gui/layer/MapViewGraphics.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/MapViewGraphics.java	(revision 13386)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/MapViewGraphics.java	(revision 13387)
@@ -60,3 +60,8 @@
         return clipBounds;
     }
+
+    @Override
+    public String toString() {
+        return "MapViewGraphics [graphics=" + graphics + ", mapView=" + mapView + ", clipBounds=" + clipBounds + ']';
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/gui/layer/imagery/TileCoordinateConverter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/imagery/TileCoordinateConverter.java	(revision 13386)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/imagery/TileCoordinateConverter.java	(revision 13387)
@@ -202,5 +202,5 @@
      */
     public boolean requiresReprojection() {
-        return !tileSource.getServerCRS().equals(Main.getProjection().toCode());
+        return !Objects.equals(tileSource.getServerCRS(), Main.getProjection().toCode());
     }
 }
