aboutsummaryrefslogtreecommitdiff
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/Curve.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/generic/Curve.c b/generic/Curve.c
index ed75c83..b580d56 100644
--- a/generic/Curve.c
+++ b/generic/Curve.c
@@ -1682,6 +1682,15 @@ Coords(ZnItem item,
/*printf("contour %d, num_pts %d, index %d, cmd %d\n",
contour, *num_pts, index, cmd);*/
/*printf("nb contours: %d\n", cv->shape.num_contours);*/
+ /*
+ * Special case for reading an empty curve.
+ */
+ if (((cmd == ZN_COORDS_READ) || (cmd == ZN_COORDS_READ_ALL)) &&
+ (cv->shape.num_contours == 0)) {
+ *num_pts = 0;
+ return TCL_OK;
+ }
+
if (contour < 0) {
contour += cv->shape.num_contours;
}
@@ -1792,6 +1801,11 @@ Coords(ZnItem item,
}
}
else {
+ /* Special case for an empty contour. */
+ if (c->num_points == 0) {
+ *num_pts = 0;
+ return TCL_OK;
+ }
if (index < 0) {
index += c->num_points;
}