diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 735a25bea7..43c74d46d9 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -152,14 +152,13 @@ OpenLayers.Map.prototype = { this.layers = []; - if (this.controls) { - for(var i=0; i < this.controls.length; i++) { - this.addControlToMap(this.controls[i]); - } - } else { - this.controls = []; - this.addControl(new OpenLayers.Control.MouseDefaults()); - this.addControl(new OpenLayers.Control.PanZoom()); + if (this.controls == null) { + this.controls = [ new OpenLayers.Control.MouseDefaults(), + new OpenLayers.Control.PanZoom()]; + } + + for(var i=0; i < this.controls.length; i++) { + this.addControlToMap(this.controls[i]); } this.popups = new Array();