diff options
author | Anand Thakker <github@anandthakker.net> | 2018-04-11 14:13:48 -0400 |
---|---|---|
committer | Anand Thakker <github@anandthakker.net> | 2018-04-11 14:13:48 -0400 |
commit | 68957406bc139229577cbf913926850de4bc3f19 (patch) | |
tree | 7ac16efe47be458753459a3bb832f770620704fb | |
parent | 148416f75f85296bf02b6c937beae0d0b465eb7e (diff) | |
download | qtlocation-mapboxgl-upstream/vtzero.tar.gz |
Handle exceptions from vtzero::decode_geometry()upstream/vtzero
-rw-r--r-- | src/mbgl/tile/vector_tile_data.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mbgl/tile/vector_tile_data.cpp b/src/mbgl/tile/vector_tile_data.cpp index 6e619dab48..93dba57b4b 100644 --- a/src/mbgl/tile/vector_tile_data.cpp +++ b/src/mbgl/tile/vector_tile_data.cpp @@ -1,5 +1,6 @@ #include <mbgl/tile/vector_tile_data.hpp> #include <mbgl/util/constants.hpp> +#include <mbgl/util/logging.hpp> namespace mbgl { @@ -109,11 +110,16 @@ struct GeometryHandler { GeometryCollection VectorTileFeature::getGeometries() const { const float scale = float(util::EXTENT) / layer.extent(); const vtzero::geometry geometry = feature.geometry(); - GeometryCollection lines = vtzero::decode_geometry(geometry, GeometryHandler(scale)); - if (layer.version() >= 2 || feature.geometry_type() != vtzero::GeomType::POLYGON) { - return lines; - } else { - return fixupPolygons(lines); + try { + GeometryCollection lines = vtzero::decode_geometry(geometry, GeometryHandler(scale)); + if (layer.version() >= 2 || feature.geometry_type() != vtzero::GeomType::POLYGON) { + return lines; + } else { + return fixupPolygons(lines); + } + } catch (const std::exception& e) { + Log::Warning(Event::ParseTile, std::string("vtzero: ") + e.what()); + return {}; } } |