aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/MainMap.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/modern/src/MainMap.js b/modern/src/MainMap.js
index 01230da9..aea6dd89 100644
--- a/modern/src/MainMap.js
+++ b/modern/src/MainMap.js
@@ -116,14 +116,17 @@ class MainMap extends Component {
this.map.addControl(new mapboxgl.NavigationControl());
- this.map.fitBounds(this.calculateBounds(), {
- padding: 100,
- maxZoom: 9
- });
+ const bounds = this.calculateBounds();
+ if (bounds) {
+ this.map.fitBounds(bounds, {
+ padding: 100,
+ maxZoom: 9
+ });
+ }
}
calculateBounds() {
- if (this.props.data.features) {
+ if (this.props.data.features && this.props.data.features.length) {
const first = this.props.data.features[0].geometry.coordinates;
const bounds = [[...first], [...first]];
for (let feature of this.props.data.features) {
@@ -142,7 +145,7 @@ class MainMap extends Component {
}
return bounds;
} else {
- return [[0, 0], [0, 0]];
+ return null;
}
}