Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java	(revision 19701)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java	(revision 19702)
@@ -99,7 +99,9 @@
     public void destroy() {
         // if the layer is currently saving the images in the cache, wait until it's finished
-        while (!cacheControl.isCachePipeEmpty()) {
-            System.out.println("Try to close a WMSLayer which is currently saving in cache : wait 1 sec.");
-            CadastrePlugin.safeSleep(1000);
+        if (cacheControl != null) {
+            while (!cacheControl.isCachePipeEmpty()) {
+                System.out.println("Try to close a WMSLayer which is currently saving in cache : wait 1 sec.");
+                CadastrePlugin.safeSleep(1000);
+            }
         }
         super.destroy();
