From e545c7052c7d7f4f0ed654e6279f43a247f32a54 Mon Sep 17 00:00:00 2001 From: John Helmert Date: Fri, 7 Jun 2019 11:39:09 -0500 Subject: [PATCH] Fix Github issue #695 Caused by Page.move_to_bottom() setting self.nav.page_index to -1, only possible when there are no comments on a submission, but which also caused a crash when rendering. --- rtv/page.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rtv/page.py b/rtv/page.py index bf21377..f9ab5bd 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -236,6 +236,12 @@ class Page(object): """ Move the cursor to the last item on the page. """ + + # If the page is empty, don't try to go to the bottom, rtv will + # crash when rendering + if self.content.range[1] < 0: + return + self.nav.page_index = self.content.range[1] self.nav.cursor_index = 0 self.nav.inverted = True