Edit book: Fix check book failling in the presence of empty <style/> tags. Fixes #1292841 [Edit book / check crashes on empty inline style tag](https://bugs.launchpad.net/calibre/+bug/1292841)

This commit is contained in:
Kovid Goyal 2014-03-15 18:59:33 +05:30
parent 5864635e4a
commit 6d60befc70

View File

@ -50,7 +50,7 @@ def run_checks(container):
for name, mt, raw in html_items:
root = container.parsed(name)
for style in root.xpath('//*[local-name()="style"]'):
if style.get('type', 'text/css') == 'text/css':
if style.get('type', 'text/css') == 'text/css' and style.text:
errors.extend(check_css_parsing(name, style.text, line_offset=style.sourceline - 1))
for elem in root.xpath('//*[@style]'):
raw = elem.get('style')