The feature handler should not handle destroyed features. Or any features without a layer for that matter. r=elemoine (closes #1806)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@8284 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-11-05 21:23:55 +00:00
parent 0d2760831d
commit b916be5489
3 changed files with 51 additions and 13 deletions

View File

@@ -223,7 +223,7 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
var previouslyIn = !!(this.feature); // previously in a feature
var click = (type == "click" || type == "dblclick");
this.feature = this.layer.getFeatureFromEvent(evt);
if(this.feature) {
if(this.feature && this.feature.layer) {
var inNew = (this.feature != this.lastFeature);
if(this.geometryTypeMatches(this.feature)) {
// in to a feature
@@ -251,7 +251,8 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
this.feature = null;
}
} else {
if(previouslyIn || (click && this.lastFeature)) {
if(this.lastFeature && this.lastFeature.layer &&
(previouslyIn || click)) {
this.triggerCallback(type, 'out', [this.lastFeature]);
}
}