summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cairo-hull.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cairo-hull.c b/src/cairo-hull.c
index 73d95c554..ccdb34d45 100644
--- a/src/cairo-hull.c
+++ b/src/cairo-hull.c
@@ -125,8 +125,13 @@ _cairo_hull_vertex_compare (const void *av, const void *bv)
static int
_cairo_hull_prev_valid (cairo_hull_t *hull, int num_hull, int index)
{
+ /* hull[0] is always valid, and we never need to wraparound, (if
+ * we are passed an index of 0 here, then the calling loop is just
+ * about to terminate). */
+ if (index == 0)
+ return 0;
+
do {
- /* hull[0] is always valid, so don't test and wraparound */
index--;
} while (hull[index].discard);