From 803dd402daf27c79da0f1e00ac69293b32c30531 Mon Sep 17 00:00:00 2001 From: Dmitry Andreev Date: Wed, 31 May 2017 09:28:51 -0400 Subject: [PATCH] check for map.options.attributionControl && map.attributionControl before add attribution --- src/OperationalLayer.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/OperationalLayer.js b/src/OperationalLayer.js index 54f3eb7..9253f46 100644 --- a/src/OperationalLayer.js +++ b/src/OperationalLayer.js @@ -336,15 +336,17 @@ export function _generateEsriLayer (layer, layers, map, params, paneName) { token: params.token || null }); - L.esri.request(layer.url, {}, function (err, res) { - if (err) { - console.log(err); - } else { - var maxWidth = (map.getSize().x - 55); - var tiledAttribution = '' + res.copyrightText + ''; - map.attributionControl.addAttribution(tiledAttribution); - } - }); + if (map.options.attributionControl && map.attributionControl) { + L.esri.request(layer.url, {}, function (err, res) { + if (err) { + console.log(err); + } else { + var maxWidth = (map.getSize().x - 55); + var tiledAttribution = '' + res.copyrightText + ''; + map.attributionControl.addAttribution(tiledAttribution); + } + }); + } } document.getElementsByClassName('leaflet-tile-pane')[0].style.opacity = layer.opacity || 1;