1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 05:01:10 +02:00

cameo/poly2d.c (paths_to_polys_z): correctly ignore empty paths

This commit is contained in:
Werner Almesberger 2015-01-16 08:38:30 -03:00
parent 4d15951807
commit c9c0e887e7

View File

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