From d4c38aa96f8404f3178031592e773a72b30df533 Mon Sep 17 00:00:00 2001 From: rahighi Date: Thu, 26 Aug 2021 13:11:23 +0430 Subject: Merge branch 'master' of https://github.com/traccar/traccar-web --- modern/src/map/PositionsMap.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'modern/src/map/PositionsMap.js') diff --git a/modern/src/map/PositionsMap.js b/modern/src/map/PositionsMap.js index 9719b45b..8d100534 100644 --- a/modern/src/map/PositionsMap.js +++ b/modern/src/map/PositionsMap.js @@ -148,9 +148,15 @@ const PositionsMap = ({ positions }) => { map.off('click', id, onMarkerClick); map.off('click', clusters, onClusterClick); - map.removeLayer(id); - map.removeLayer(clusters); - map.removeSource(id); + if (map.getLayer(id)) { + map.removeLayer(id); + } + if (map.getLayer(clusters)) { + map.removeLayer(clusters); + } + if (map.getSource(id)) { + map.removeSource(id); + } }; }, [onMarkerClick]); -- cgit v1.2.3