diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index e90a09c6ad..9e62434c44 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -816,7 +816,9 @@ OpenLayers.Map = OpenLayers.Class({ if (this.controls != null) { for (var i = this.controls.length - 1; i>=0; --i) { - this.controls[i].destroy(); + if(this.controls[i] != undefined) { + this.controls[i].destroy(); + } } this.controls = null; }