From 9ec1c06e7f57e81a696eb684a19bbd361ea5fe79 Mon Sep 17 00:00:00 2001 From: mbarto Date: Wed, 9 Nov 2016 12:37:22 +0100 Subject: [PATCH] Fixes #1260: validate shapefile geometries bbox before zoom (#1261) --- web/client/components/shapefile/ShapefileUploadAndStyle.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/client/components/shapefile/ShapefileUploadAndStyle.jsx b/web/client/components/shapefile/ShapefileUploadAndStyle.jsx index dc88bf2445..0d7dbdb4d3 100644 --- a/web/client/components/shapefile/ShapefileUploadAndStyle.jsx +++ b/web/client/components/shapefile/ShapefileUploadAndStyle.jsx @@ -163,12 +163,12 @@ const ShapeFileUploadAndStyle = React.createClass({ // calculates the bbox that contains all shapefiles added const bbox = this.props.layers[0].features.reduce((bboxtotal, feature) => { - return [ + return (feature.geometry.bbox[0] && feature.geometry.bbox[1] && feature.geometry.bbox[2] && feature.geometry.bbox[3] ) && [ Math.min(bboxtotal[0], feature.geometry.bbox[0]), Math.min(bboxtotal[1], feature.geometry.bbox[1]), Math.max(bboxtotal[2], feature.geometry.bbox[2]), Math.max(bboxtotal[3], feature.geometry.bbox[3]) - ]; + ] || bboxtotal; }, this.props.bbox); if (this.state.zoomOnShapefiles) { this.props.updateShapeBBox(bbox);