Skip to content

Commit

Permalink
Fix #1694757: calibre fails to start if the tweak tag_browser_categor…
Browse files Browse the repository at this point in the history
…y_order is malformed.
  • Loading branch information
cbhaley committed Jun 1, 2017
1 parent a91df2f commit 4634fb3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/calibre/gui2/tag_browser/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,13 @@ def _get_category_nodes(self, sort):
self.categories[category] = tb_categories[category]['name']

# Now build the list of fields in display order
order = tweaks['tag_browser_category_order']
try:
order = tweaks['tag_browser_category_order']
if not isinstance(order, dict):
raise TypeError()
except:
print ('Tweak tag_browser_category_order is not valid. Ignored')
order = {'*': 100}
defvalue = order.get('*', 100)
self.row_map = sorted(self.categories, key=lambda x: order.get(x, defvalue))
return data
Expand Down

0 comments on commit 4634fb3

Please sign in to comment.