return gracefully instead of failing of geometry is only a single node

This commit is contained in:
Dennis Luxen 2014-05-12 10:33:37 +02:00
parent 07231d3706
commit a6bfec22b5

View File

@ -62,9 +62,14 @@ DouglasPeucker::DouglasPeucker()
void DouglasPeucker::Run(std::vector<SegmentInformation> &input_geometry, const unsigned zoom_level)
{
BOOST_ASSERT_MSG(!input_geometry.empty(), "geometry invalid");
if (input_geometry.size() <= 2)
{
return;
}
{
BOOST_ASSERT_MSG(zoom_level < 19, "unsupported zoom level");
BOOST_ASSERT_MSG(1 < input_geometry.size(), "geometry invalid");
unsigned left_border = 0;
unsigned right_border = 1;
// Sweep over array and identify those ranges that need to be checked