diff --git a/poly2d/f2d_tri_holes.cpp b/poly2d/f2d_tri_holes.cpp index 37844ac..e8406bd 100644 --- a/poly2d/f2d_tri_holes.cpp +++ b/poly2d/f2d_tri_holes.cpp @@ -169,11 +169,15 @@ void insert_polygon(CDT &cdt, const Polygon_2 &polygon) static const struct v2d *find_point(const struct p2d *p, double x, double y) { - const struct v2d *v; + const struct v2d *v = p->v; - for (v = p->v; v; v = v->next) + while (v) { if (v->x == x && v->y == y) break; + v = v->next; + if (v == p->v) + return NULL; + } return v; }