avoid calling correct on empty geometries

This commit is contained in:
Dane Springmeyer 2016-06-29 09:20:02 -07:00
parent 39f497ded6
commit abe175c14f
2 changed files with 12 additions and 5 deletions

View file

@ -192,13 +192,20 @@ struct exterior_ring<mapnik::geometry::polygon<CoordinateType> >
{
static mapnik::geometry::linear_ring<CoordinateType> & get(mapnik::geometry::polygon<CoordinateType> & p)
{
if (p.empty()) p.emplace_back();
return p.at(0);
if (p.empty()) {
abort();
throw std::runtime_error("ring must be initialized 1");
}
return p[0];
}
static mapnik::geometry::linear_ring<CoordinateType> const& get(mapnik::geometry::polygon<CoordinateType> const& p)
{
return p.at(0);
if (p.empty()) {
abort();
throw std::runtime_error("ring must be initialized 2");
}
return p[0];
}
};

View file

@ -60,13 +60,13 @@ struct geometry_correct
template <typename T>
result_type operator() (polygon<T> & poly) const
{
boost::geometry::correct(poly);
if (!poly.empty()) boost::geometry::correct(poly);
}
template <typename T>
result_type operator() (multi_polygon<T> & multi_poly) const
{
boost::geometry::correct(multi_poly);
if (!multi_poly.empty()) boost::geometry::correct(multi_poly);
}
template <typename T>