From 2258d65234ada77e085cddb47d51fb22ebe9bb7b Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Fri, 22 Mar 2024 15:58:58 -0400 Subject: [PATCH] fix: avoid crashing on maps without a source --- src/gis/components/Map.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gis/components/Map.js b/src/gis/components/Map.js index 94c052fc5..646c57c59 100644 --- a/src/gis/components/Map.js +++ b/src/gis/components/Map.js @@ -166,8 +166,13 @@ export const MapProvider = props => { if (!map) { return; } + let currentSource; - const currentSource = map.getSource(name); + try { + currentSource = map.getSource(name); + } catch (error) { + console.log('Error getting source', error); + } try { const isGeoJson = source.type === 'geojson';