diff --git a/src/GeoJsonPages/Semantic/SubObjectBuilder.php b/src/GeoJsonPages/Semantic/SubObjectBuilder.php index 9edfa14b..c36c07a7 100644 --- a/src/GeoJsonPages/Semantic/SubObjectBuilder.php +++ b/src/GeoJsonPages/Semantic/SubObjectBuilder.php @@ -4,10 +4,10 @@ namespace Maps\GeoJsonPages\Semantic; +use GeoJson\Exception\UnserializationException; use GeoJson\Feature\FeatureCollection; use GeoJson\GeoJson; use GeoJson\Geometry\Point; -use Title; class SubObjectBuilder { @@ -18,7 +18,14 @@ class SubObjectBuilder { */ public function getSubObjectsFromGeoJson( string $jsonString ) { $json = json_decode( $jsonString ); - $geoJson = GeoJson::jsonUnserialize( $json ); + + try { + $geoJson = GeoJson::jsonUnserialize( $json ); + } + catch ( UnserializationException ) { + // TODO: log warning + return []; + } return iterator_to_array( $this->featureCollectionToSubObjects( $geoJson ) ); }