Skip to content

Commit

Permalink
fix: check empty bounds when fitting map to landscape list
Browse files Browse the repository at this point in the history
  • Loading branch information
tm-ruxandra committed Feb 28, 2024
1 parent 1b4c8a7 commit c19a3cc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/landscape/components/LandscapeListMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,12 @@ const Clusters = props => {
new mapboxgl.LngLatBounds()
);

map.fitBounds(bounds, {
padding: 50,
});
if (!bounds.isEmpty()) {
map.fitBounds(bounds, {
padding: 50,
});
}

return () => {
map.off('click', 'clusters', onClusterClick);
map.off('click', 'unclustered-point', onUnclusteredPointClick);
Expand Down

0 comments on commit c19a3cc

Please sign in to comment.