Merge pull request #273 from tschaub/permalink
Make permalink destruction safe (r: @ahocevar).
This commit is contained in:
@@ -94,12 +94,13 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
|
||||
* APIMethod: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
if (this.element.parentNode == this.div) {
|
||||
if (this.element && this.element.parentNode == this.div) {
|
||||
this.div.removeChild(this.element);
|
||||
this.element = null;
|
||||
}
|
||||
if (this.map) {
|
||||
this.map.events.unregister('moveend', this, this.updateLink);
|
||||
}
|
||||
this.element = null;
|
||||
|
||||
this.map.events.unregister('moveend', this, this.updateLink);
|
||||
|
||||
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user