diff --git a/cameo/poly2d.c b/cameo/poly2d.c index a8d1460..d738e66 100644 --- a/cameo/poly2d.c +++ b/cameo/poly2d.c @@ -1,8 +1,8 @@ /* * poly2d.c - Poly2D interface functions * - * Written 2012 by Werner Almesberger - * Copyright 2012 Werner Almesberger + * Written 2012, 2015 by Werner Almesberger + * Copyright 2012, 2015 Werner Almesberger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -11,6 +11,7 @@ */ +#include #include #include @@ -46,6 +47,8 @@ struct p2d *paths_to_polys_z(const struct path *paths, if (path->first->z < zmin || path->first->z > zmax) continue; *last = path_to_poly(path); + if (!*last) + continue; last = &(*last)->next; } return polys;