New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IndexError exception when paginator gets called with empty object #246

Closed
SebastiaanZ opened this Issue Jan 3, 2019 · 1 comment

Comments

Projects
None yet
1 participant
@SebastiaanZ
Copy link
Member

SebastiaanZ commented Jan 3, 2019

Calling the paginator with an empty object (e.g., like it is called when you call !otname list if there are no names in the list) currently results in an IndexError exception. It's probably a good idea to go over all paginators to check if the all suffer from the same bug.

Either add a check or add an empty line when the input object is empty.

Traceback (most recent call last):
  File "/home/sebastiaan/.local/share/virtualenvs/bot-05f_83Kn/src/discord-py/discord/client.py", line 225, in _run_event
    await coro(*args, **kwargs)
  File "/home/sebastiaan/pydis/bot/bot/cogs/events.py", line 146, in on_command_error
    raise e.original
  File "/home/sebastiaan/.local/share/virtualenvs/bot-05f_83Kn/src/discord-py/discord/ext/commands/core.py", line 61, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/sebastiaan/pydis/bot/bot/cogs/off_topic_names.py", line 164, in list_command
    await LinePaginator.paginate(lines, ctx, embed, max_size=400, empty=False)
  File "/home/sebastiaan/pydis/bot/bot/pagination.py", line 165, in paginate
    embed.description = paginator.pages[current_page]
IndexError: list index out of range
@SebastiaanZ

This comment has been minimized.

Copy link
Member

SebastiaanZ commented Jan 3, 2019

Should be fixed now with #247

@SebastiaanZ SebastiaanZ closed this Jan 3, 2019

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