diff options
author | rahighi <rahighi> | 2021-08-26 13:11:23 +0430 |
---|---|---|
committer | rahighi <rahighi> | 2021-08-26 13:11:23 +0430 |
commit | d4c38aa96f8404f3178031592e773a72b30df533 (patch) | |
tree | faf0bfada7b5d98b3cbe34230a7628ba6d16a030 /modern/src/map/GeofenceMap.js | |
parent | b18da8ebebca5d40fb58fa270530cb9b048ff6ec (diff) | |
download | trackermap-web-d4c38aa96f8404f3178031592e773a72b30df533.tar.gz trackermap-web-d4c38aa96f8404f3178031592e773a72b30df533.tar.bz2 trackermap-web-d4c38aa96f8404f3178031592e773a72b30df533.zip |
Merge branch 'master' of https://github.com/traccar/traccar-web
Diffstat (limited to 'modern/src/map/GeofenceMap.js')
-rw-r--r-- | modern/src/map/GeofenceMap.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/modern/src/map/GeofenceMap.js b/modern/src/map/GeofenceMap.js index d00cbb18..c0ecef40 100644 --- a/modern/src/map/GeofenceMap.js +++ b/modern/src/map/GeofenceMap.js @@ -56,10 +56,18 @@ const GeofenceMap = () => { }); return () => { - map.removeLayer('geofences-fill'); - map.removeLayer('geofences-line'); - map.removeLayer('geofences-title'); - map.removeSource(id); + if (map.getLayer('geofences-fill')) { + map.removeLayer('geofences-fill'); + } + if (map.getLayer('geofences-line')) { + map.removeLayer('geofences-line'); + } + if (map.getLayer('geofences-title')) { + map.removeLayer('geofences-title'); + } + if (map.getSource(id)) { + map.removeSource(id); + } }; }, []); |