Skip to content

Commit

Permalink
gh-35156: Fix index out of range exception (#35031)
Browse files Browse the repository at this point in the history
    
### 📚 Description
We return False if there is no n-th path

Closes #35031

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [X] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [X] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.
    
URL: #35156
Reported by: Andrew
Reviewer(s): Sébastien Labbé
  • Loading branch information
Release Manager committed Mar 24, 2023
2 parents 525b34d + d9f9a36 commit f8e7176
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/sage/plot/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,10 @@ def get_paths(self, renderer):
return paths

def __call__(self, renderer, gc, tpath, affine, rgbFace):
path = self.get_paths(renderer)[self._n]
paths = self.get_paths(renderer)
if self._n >= len(paths):
return False
path = paths[self._n]
vert1, code1 = path.vertices, path.codes
import numpy as np

Expand Down Expand Up @@ -470,6 +473,13 @@ def arrow(tailpoint=None, headpoint=None, **kwds):
sphinx_plot(arrow((0,0,1), (1,1,1)))
TESTS:
Check that :trac:`35031` is fixed::
sage: arrow((0,0), (0,0), linestyle='dashed')
Graphics object consisting of 1 graphics primitive
"""
try:
return arrow2d(tailpoint, headpoint, **kwds)
Expand Down

0 comments on commit f8e7176

Please sign in to comment.