only try to set the attribution string if the map actually has some layers. (Closes #979)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@4338 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -66,13 +66,15 @@ OpenLayers.Control.Attribution =
|
|||||||
*/
|
*/
|
||||||
updateAttribution: function() {
|
updateAttribution: function() {
|
||||||
var attributions = [];
|
var attributions = [];
|
||||||
for(var i=0; i < this.map.layers.length; i++) {
|
if (this.map && this.map.layers) {
|
||||||
var layer = this.map.layers[i];
|
for(var i=0; i < this.map.layers.length; i++) {
|
||||||
if (layer.attribution && layer.getVisibility()) {
|
var layer = this.map.layers[i];
|
||||||
attributions.push( layer.attribution );
|
if (layer.attribution && layer.getVisibility()) {
|
||||||
|
attributions.push( layer.attribution );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.div.innerHTML = attributions.join(this.separator);
|
||||||
}
|
}
|
||||||
this.div.innerHTML = attributions.join(this.separator);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
|
|||||||
Reference in New Issue
Block a user