Avoid error on startup with toc panel open and no book

This commit is contained in:
Kovid Goyal 2021-05-13 07:07:49 +05:30
parent f06afd8437
commit 505c92df47
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -137,7 +137,10 @@ class TOCView(QTreeView):
self.model().update_current_toc_nodes(families)
def scroll_to_current_toc_node(self):
nodes = self.model().viewed_nodes()
try:
nodes = self.model().viewed_nodes()
except AttributeError:
nodes = ()
if nodes:
self.scrollTo(nodes[-1].index())