Skip to content

Conversation

@patrick91
Copy link
Owner

When pressing Ctrl+C in a menu, the render_menu function would crash with IndexError because element.selected was invalid after cancellation.

Problem

IndexError: list index out of range

This happened in render_menu at:

element.options[element.selected]["name"]

Solution

Check if the element was cancelled or has an invalid selection before trying to access the selected option. Display "Cancelled." with the cancelled style instead of crashing.

When pressing Ctrl+C in a menu, the render_menu function would crash
with IndexError because element.selected was invalid after cancellation.

Now we check if the element was cancelled or has an invalid selection
before trying to access the selected option, and display 'Cancelled.'
instead.
@github-actions
Copy link

github-actions bot commented Dec 3, 2025

Hi, thanks for contributing to this project!

We noticed that this PR is missing a RELEASE.md file. We use that to automatically do releases here on GitHub and, most importantly, to PyPI!

So as soon as this PR is merged, a release will be made 🚀.

Here's an example of RELEASE.md:

---
release type: patch
---

Description of the changes, ideally with some examples, if adding a new feature.

Release type can be one of patch, minor or major. We use [semver](https://semver.org/), so make sure to pick the appropriate type. If in doubt feel free to ask :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants