OpenLayers OpenLayers

Ticket #1346: events_check.patch

File events_check.patch, 0.5 kB (added by tschaub, 1 year ago)

only destroy events if it exists

  • lib/OpenLayers/Control.js

    old new  
    165165     * to prevent memory leaks. 
    166166     */ 
    167167    destroy: function () { 
    168         this.events.destroy(); 
    169         this.events = null; 
     168        if(this.events) { 
     169            this.events.destroy(); 
     170            this.events = null; 
     171        } 
    170172        // eliminate circular references 
    171173        if (this.handler) { 
    172174            this.handler.destroy();