From cfb1b472a7f2f66b997a8ba55d05560047711099 Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Wed, 24 May 2006 05:44:43 +0000 Subject: [PATCH] Calling map.destroy() twice previously an error in IE. Fixed. git-svn-id: http://svn.openlayers.org/trunk/openlayers@314 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Map.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 2d8d03caad..f5736c5c2c 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -111,14 +111,18 @@ OpenLayers.Map.prototype = { /** */ destroy:function() { - for(var i=0; i< this.layers.length; i++) { - this.layers[i].destroy(); - } - this.layers = null; - for(var i=0; i< this.controls.length; i++) { - this.controls[i].destroy(); - } - this.controls = null; + if (this.layers != null) { + for(var i=0; i< this.layers.length; i++) { + this.layers[i].destroy(); + } + this.layers = null; + } + if (this.controls != null) { + for(var i=0; i< this.controls.length; i++) { + this.controls[i].destroy(); + } + this.controls = null; + } }, /**