Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46e9f6f

Browse files
committed
Raise an error in the pdf backend instead of outputting an invalid path if a Path object lacks initial moveto
svn path=/trunk/matplotlib/; revision=7899
1 parent 139e546 commit 46e9f6f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/matplotlib/backends/backend_pdf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,8 +1206,12 @@ def pathOperations(path, transform, clip=None):
12061206
last_points = None
12071207
for points, code in path.iter_segments(transform, clip=clip):
12081208
if code == Path.MOVETO:
1209+
# This is allowed anywhere in the path
12091210
cmds.extend(points)
12101211
cmds.append(Op.moveto)
1212+
elif last_points is None:
1213+
# The other operations require a previous point
1214+
raise ValueError, 'Path lacks initial MOVETO'
12111215
elif code == Path.LINETO:
12121216
cmds.extend(points)
12131217
cmds.append(Op.lineto)

0 commit comments

Comments
 (0)