diff options
-rw-r--r-- | fitz/node_path.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fitz/node_path.c b/fitz/node_path.c index f10fd982..c21de87a 100644 --- a/fitz/node_path.c +++ b/fitz/node_path.c @@ -95,6 +95,8 @@ fz_moveto(fz_pathnode *path, float x, float y) fz_error fz_lineto(fz_pathnode *path, float x, float y) { + if (path->len == 0) + return fz_throw("no current point"); if (growpath(path, 3) != fz_okay) return fz_rethrow(-1, "out of memory"); path->els[path->len++].k = FZ_LINETO; @@ -109,6 +111,8 @@ fz_curveto(fz_pathnode *path, float x2, float y2, float x3, float y3) { + if (path->len == 0) + return fz_throw("no current point"); if (growpath(path, 7) != fz_okay) return fz_rethrow(-1, "out of memory"); path->els[path->len++].k = FZ_CURVETO; @@ -138,6 +142,12 @@ fz_curvetoy(fz_pathnode *path, float x1, float y1, float x3, float y3) fz_error fz_closepath(fz_pathnode *path) { + if (path->len == 0) + { + fz_warn("tried to close an empty path"); + return fz_okay; + } + if (growpath(path, 1) != fz_okay) return fz_rethrow(-1, "out of memory"); path->els[path->len++].k = FZ_CLOSEPATH; |