From 0726f12bbf33fcb18fe8bb541d5e3212bb1f5ab2 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 5 Jul 2016 09:07:36 +0200 Subject: [PATCH] Make sure label has been opened before trying to interact with its container --- src/layer/Layer.Label.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/layer/Layer.Label.js b/src/layer/Layer.Label.js index d1bd96d7..b4a7cab7 100644 --- a/src/layer/Layer.Label.js +++ b/src/layer/Layer.Label.js @@ -101,7 +101,9 @@ L.Layer.include({ // open the label on the map this._map.openLabel(this._label, latlng); - if (this._label.options.interactive) { + // Label container may not be defined if not permanent and never + // opened. + if (this._label.options.interactive && this._label._container) { L.DomUtil.addClass(this._label._container, 'leaflet-clickable'); this.addInteractiveTarget(this._label._container); }