wustho / epy

CLI Ebook (epub2, epub3, fb2, mobi) Reader
GNU General Public License v3.0
962 stars 52 forks source link

epy crashes sometimes when attempting to scroll using keyboard on the end of the chapter #51

Closed HakierGrzonzo closed 2 years ago

HakierGrzonzo commented 2 years ago

When viewing the second to last chapter from this epub: https://archiveofourown.org/downloads/32751484/Game%20Night.epub?updated_at=1643035440

Alternatively click download -> epub here: https://archiveofourown.org/works/32751484/chapters/91378543?view_adult=true

Epy crashes sometimes when attempting to scroll down at the end of the chapter with the following traceback:

Traceback (most recent call last):
  File "/usr/bin/epy", line 33, in <module>
    sys.exit(load_entry_point('epy-reader==2022.1.23', 'console_scripts', 'epy')())
  File "/usr/lib/python3.10/site-packages/epy.py", line 3971, in main
    filepath = curses.wrapper(preread, filepath)
  File "/usr/lib/python3.10/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/lib/python3.10/site-packages/epy.py", line 3869, in preread
    reading_state_or_ebook = reader.read(reading_state)
  File "/usr/lib/python3.10/site-packages/epy.py", line 3783, in read
    board.write(reading_state.row)
  File "/usr/lib/python3.10/site-packages/epy.py", line 1706, in write
    text_line = self.text[row + n_row]
IndexError: tuple index out of range

Other info:

$ epy --version
v2022.1.23
wustho commented 2 years ago

@HakierGrzonzo Hey there, thanks for detailed traceback, mate. Just fixed the issue with this commit: https://github.com/wustho/epy/commit/9d59248c311a52eb03ffeb30701c2e2b12ec8df7

Cheers