From dee879ef64fd69b640d97f709b9f108610d5139c Mon Sep 17 00:00:00 2001 From: Davor Racic Date: Sat, 19 Dec 2015 12:45:23 +0100 Subject: [PATCH] Patch to fix destroy() being called on an undefined object https://github.com/heron-mc/heron-mc/issues/399 --- lib/OpenLayers/Map.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index e90a09c6ad..9e62434c44 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -816,7 +816,9 @@ OpenLayers.Map = OpenLayers.Class({ if (this.controls != null) { for (var i = this.controls.length - 1; i>=0; --i) { - this.controls[i].destroy(); + if(this.controls[i] != undefined) { + this.controls[i].destroy(); + } } this.controls = null; }