From c930bbcf7d1c688b5b42d3f5a1062f53236407d0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 24 Oct 2020 06:04:01 +0530 Subject: [PATCH] Fix #1901250 [TagTreeItem error in beta](https://bugs.launchpad.net/calibre/+bug/1901250) --- src/calibre/gui2/tag_browser/view.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 4b060e7d88..27ae93c981 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -858,14 +858,18 @@ class TagsView(QTreeView): # {{{ # Add expand menu items self.context_menu.addSeparator() m = self.context_menu.addMenu(_('Expand or collapse')) - node_name = self._model.get_node(index).tag.name - if self.has_children(index) and not self.isExpanded(index): - m.addAction(self.plus_icon, - _('Expand {0}').format(node_name), partial(self.expand, index)) - if self.has_unexpanded_children(index): - m.addAction(self.plus_icon, - _('Expand {0} and its children').format(node_name), - partial(self.expand_node_and_children, index)) + try: + node_name = self._model.get_node(index).tag.name + except AttributeError: + pass + else: + if self.has_children(index) and not self.isExpanded(index): + m.addAction(self.plus_icon, + _('Expand {0}').format(node_name), partial(self.expand, index)) + if self.has_unexpanded_children(index): + m.addAction(self.plus_icon, + _('Expand {0} and its children').format(node_name), + partial(self.expand_node_and_children, index)) # Add menu items to collapse parent nodes idx = index