mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
html2lrf shouldn't die on empty HTML files.
This commit is contained in:
parent
0d86fc0cf2
commit
0603501067
@ -517,7 +517,13 @@ class HTMLConverter(object, LoggingInterface):
|
|||||||
return c
|
return c
|
||||||
raise ConversionError(_('Could not parse file: %s')%self.file_name)
|
raise ConversionError(_('Could not parse file: %s')%self.file_name)
|
||||||
else:
|
else:
|
||||||
index = self.book.pages().index(opage)
|
try:
|
||||||
|
index = self.book.pages().index(opage)
|
||||||
|
except ValueError:
|
||||||
|
self.log_warning(_('%s is an empty file')%self.file_name)
|
||||||
|
tb = self.book.create_text_block()
|
||||||
|
self.current_page.append(tb)
|
||||||
|
return tb
|
||||||
for page in list(self.book.pages()[index+1:]):
|
for page in list(self.book.pages()[index+1:]):
|
||||||
for c in page.contents:
|
for c in page.contents:
|
||||||
if isinstance(c, (TextBlock, ImageBlock)):
|
if isinstance(c, (TextBlock, ImageBlock)):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user