diff --git a/lib/gr/contour.c b/lib/gr/contour.c index 938de3a3..05c0c438 100644 --- a/lib/gr/contour.c +++ b/lib/gr/contour.c @@ -147,12 +147,12 @@ static void gradient(int ind, int n, double *xpts, double *ypts, enum contour_op if (i == txpt) { t = typt - j; - j++; + if (j < contour_vars.ydim - 1) j++; } else { t = txpt - i; - i++; + if (i < contour_vars.xdim - 1) i++; } if (i == 0)