[Commits] r2071 - sandbox/cmoullet/ux/Toolbar/ux/widgets

commits at geoext.org commits at geoext.org
Sat Apr 3 19:21:19 CEST 2010


Author: cmoullet
Date: 2010-04-03 19:21:19 +0200 (Sat, 03 Apr 2010)
New Revision: 2071

Modified:
   sandbox/cmoullet/ux/Toolbar/ux/widgets/LoadingStatusBar.js
Log:
Check layer.events

Modified: sandbox/cmoullet/ux/Toolbar/ux/widgets/LoadingStatusBar.js
===================================================================
--- sandbox/cmoullet/ux/Toolbar/ux/widgets/LoadingStatusBar.js	2010-04-03 16:36:39 UTC (rev 2070)
+++ sandbox/cmoullet/ux/Toolbar/ux/widgets/LoadingStatusBar.js	2010-04-03 17:21:19 UTC (rev 2071)
@@ -33,7 +33,7 @@
             config.map = config.map.map;
         }
         if (!config.map) {
-           config.map = GeoExt.MapPanel.guess().map;
+            config.map = GeoExt.MapPanel.guess().map;
         }
         GeoExt.ux.LoadingStatusBar.superclass.constructor.call(this, config);
     },
@@ -99,22 +99,26 @@
      *  :param layer: ``OpenLayers.Layer``
      */
     registerLayer: function(layer) {
-        layer.events.on({
-            loadstart: this.increaseCounter,
-            loadend: this.decreaseCounter,
-            scope: this
-        });
+        if (layer.events) {
+            layer.events.on({
+                loadstart: this.increaseCounter,
+                loadend: this.decreaseCounter,
+                scope: this
+            });
+        }
     },
 
     /** private: method[unregisterLayer]
      *  :param layer: ``OpenLayers.Layer``
      */
     unregisterLayer: function(layer) {
-        layer.events.un({
-            loadstart: this.increaseCounter,
-            loadend: this.decreaseCounter,
-            scope: this
-        });
+        if (layer.events) {
+            layer.events.un({
+                loadstart: this.increaseCounter,
+                loadend: this.decreaseCounter,
+                scope: this
+            });
+        }
     }
 });
 



More information about the Commits mailing list