From d1912f57e95e2a831e7ff5e5867298a2fe1426d0 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 14 Dec 2023 22:55:01 +0100 Subject: [PATCH] Do not call AttributionControl._update for removed tile layer --- umap/static/umap/js/umap.controls.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index ad6cff9f..213b8bff 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -1246,8 +1246,10 @@ L.U.AttributionControl = L.Control.Attribution.extend({ }, _update: function () { + // Layer is no more on the map + if (!this._map) return L.Control.Attribution.prototype._update.call(this) - // Use our how container, so we can hide/show on small screens + // Use our own container, so we can hide/show on small screens const credits = this._container.innerHTML this._container.innerHTML = '' const container = L.DomUtil.add(