Check Book: Fix an error caused by empty style tags when auto-renaming mismatched font names. Fixes #1363028 [renaming incorrectly named fonts fails](https://bugs.launchpad.net/calibre/+bug/1363028)

This commit is contained in:
Kovid Goyal 2014-08-29 18:23:41 +05:30
parent 5f81108d5c
commit 8f18290228

View File

@ -74,7 +74,7 @@ class FontAliasing(BaseError):
changed = True changed = True
elif mt in OEB_DOCS: elif mt in OEB_DOCS:
for style in container.parsed(name).xpath('//*[local-name()="style"]'): for style in container.parsed(name).xpath('//*[local-name()="style"]'):
if style.get('type', 'text/css') == 'text/css': if style.get('type', 'text/css') == 'text/css' and style.text:
sheet = container.parse_css(style.text) sheet = container.parse_css(style.text)
if fix_sheet(sheet, self.css_name, self.font_name): if fix_sheet(sheet, self.css_name, self.font_name):
style.text = force_unicode(sheet.cssText, 'utf-8') style.text = force_unicode(sheet.cssText, 'utf-8')