I added a ticket, a few days ago, and it might have slipped through the
cracks:

Ticket #781 (new feature)

Opened 6 days ago
Map.addLayer() fails if getExtent() returns null
Reported by:    openlayers      Assigned to:    
Priority:       minor   Milestone:      
Component:      general         Version:        2.4
Keywords:               Cc:     
Description 

In OpenLayers.Map.js, function addLayer(): if the layer being added is
not a base layer, and the map has a center, but does not have an extent,
we try to do a moveTo() to a null extent.

  if (layer.isBaseLayer)  {
    if (this.baseLayer == null) {
      // set the first baselaye we add as the baselayer
      this.setBaseLayer(layer);
    } else {
      layer.setVisibility(false);
    }
  } else {
    if (this.getCenter() != null) {
      layer.moveTo(this.getExtent(), true);   
    }
  }

this.getExtent() can, and sometimes does, return null. It can, and
sometimes does, return null when this.getCenter() does not.

Seems to me that the guard in this function should be on
this.getExtent(), since that's what is being called:

  } else {
    if (this.getExtent() != null) {
      layer.moveTo(this.getExtent(), true);   
    }
  }
_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev

Reply via email to