Fix memory access violation exception in vector_tile_data.cpp (#632)

This commit is contained in:
tdcosta100
2022-12-31 14:01:55 -03:00
committed by GitHub
parent ccd3c60e55
commit d4b33fd808

View File

@@ -1,5 +1,6 @@
#include <mbgl/tile/vector_tile_data.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/util/logging.hpp>
namespace mbgl {
@@ -40,7 +41,15 @@ FeatureIdentifier VectorTileFeature::getID() const {
const GeometryCollection& VectorTileFeature::getGeometries() const {
if (!lines) {
const auto scale = static_cast<float>(util::EXTENT) / feature.getExtent();
lines = feature.getGeometries<GeometryCollection>(scale);
try {
lines = feature.getGeometries<GeometryCollection>(scale);
}
catch(const std::runtime_error& ex) {
Log::Error(Event::ParseTile, "Could not get geometries: %s", ex.what());
lines = GeometryCollection();
}
if (feature.getVersion() < 2 && feature.getType() == mapbox::vector_tile::GeomType::POLYGON) {
lines = fixupPolygons(*lines);
}