mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 14:25:41 +02:00
Cover Browser: Fix setting an empty template for the title causes an error
This commit is contained in:
parent
431ee00643
commit
1fc681b5d6
1 changed files with 3 additions and 0 deletions
|
|
@ -94,6 +94,7 @@ def init_template(self, db):
|
|||
self.template_error_reported = False
|
||||
self.template = db.pref('cover_browser_title_template', '{title}')
|
||||
self.template_is_title = self.template == '{title}'
|
||||
self.template_is_empty = not self.template.strip()
|
||||
|
||||
def count(self):
|
||||
return self.model.count()
|
||||
|
|
@ -113,6 +114,8 @@ def caption(self, index):
|
|||
self.init_template(db)
|
||||
if self.template_is_title:
|
||||
ans = self.model.title(index)
|
||||
elif self.template_is_empty:
|
||||
ans = ''
|
||||
else:
|
||||
try:
|
||||
ans = self.render_template(self.template, index, db)
|
||||
|
|
|
|||
Loading…
Reference in a new issue