]> git.draconx.ca Git - slotifier.git/blobdiff - src/slotifier.c
Fix crash when input has no holes.
[slotifier.git] / src / slotifier.c
index b74a9ecf5112c0daa4b3bd41c1ec1b1296af5ef4..03485f5b88d37d76749560c181fca7c8faad2bbd 100644 (file)
@@ -333,6 +333,9 @@ static int slotify(gerbv_image_t *drill)
        }
 
        CNearTreeObjects(t, &holes);
+       if (!holes)
+               goto out;
+
        for (i = 0; i < CVectorSize(holes); i++) {
                gerbv_net_t *hole;
 
@@ -358,6 +361,7 @@ static int slotify(gerbv_image_t *drill)
                        gerbv_image_delete_net(hole);
        }
 
+out:
        CNearTreeFree(&t);
        return ret;
 }