toPolygon2d() should never return NULL

master
Marius Kintel 2014-11-27 20:38:09 -05:00
parent defb486a64
commit 91139402ea
1 changed files with 3 additions and 4 deletions

View File

@ -588,6 +588,9 @@ std::string DxfData::dump() const
return out.str();
}
/*
May return an empty polygon, but will not return NULL
*/
Polygon2d *DxfData::toPolygon2d() const
{
Polygon2d *poly = new Polygon2d();
@ -602,9 +605,5 @@ Polygon2d *DxfData::toPolygon2d() const
}
poly->addOutline(outline);
}
if (poly->outlines().size() == 0) {
delete poly;
poly = NULL;
}
return poly;
}