diff options
author | Tor Andersson <tor@ghostscript.com> | 2009-04-08 15:12:39 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2009-04-08 15:12:39 +0200 |
commit | ebcfe7408de48710782ef659a2a5313692388514 (patch) | |
tree | 3cb8b97b5c15349922c9c3e4a9a09b01dd118258 | |
parent | ed53573c4611d24e345477f8af457417c61759b0 (diff) | |
download | mupdf-ebcfe7408de48710782ef659a2a5313692388514.tar.xz |
Warn when closing an empty path instead of aborting.
-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; |