Skip to content

Commit

Permalink
Merge pull request #207 from mathandy/fix-issue-205
Browse files Browse the repository at this point in the history
return error if Path.point() cannot be computed
  • Loading branch information
mathandy authored May 20, 2023
2 parents 788b2b4 + b282094 commit 6015a97
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion svgpathtools/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -2572,7 +2572,7 @@ def point(self, pos):

# Shortcuts
if len(self._segments) == 0:
return None
raise ValueError("This path contains no segments!")
if pos == 0.0:
return self._segments[0].point(pos)
if pos == 1.0:
Expand All @@ -2589,6 +2589,7 @@ def point(self, pos):
segment_end - segment_start)
return segment.point(segment_pos)
segment_start = segment_end
raise RuntimeError("Something has gone wrong. Could not compute Path.point({}) for path {}".format(pos, self))

def length(self, T0=0, T1=1, error=LENGTH_ERROR, min_depth=LENGTH_MIN_DEPTH):
self._calc_lengths(error=error, min_depth=min_depth)
Expand Down

0 comments on commit 6015a97

Please sign in to comment.