make SelectControl.unselectAll safer

This commit is contained in:
Éric Lemoine
2012-05-29 23:01:36 +02:00
parent bd27f6a2ae
commit e603b06715
2 changed files with 34 additions and 2 deletions

View File

@@ -306,8 +306,12 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
layer = layers[l];
for(var i=layer.selectedFeatures.length-1; i>=0; --i) {
feature = layer.selectedFeatures[i];
if(!options || options.except != feature) {
this.unselect(feature);
// feature can be undefined here if an unselectfeature
// listeners has unselected or removed other features
if(feature) {
if(!options || options.except != feature) {
this.unselect(feature);
}
}
}
}