EPUB Input: Fix empty adobe page number template file causing conversion to fail. Fixes #1995551 [[Bug] Convert EPUB Fail (TypeError: cannot convert 'NoneType' object to bytes)](https://bugs.launchpad.net/calibre/+bug/1995551)

This commit is contained in:
Kovid Goyal 2022-11-03 11:07:19 +05:30
parent f77e2d693d
commit 58e506d0cd
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -432,7 +432,7 @@ def serialize(data, media_type, pretty_print=False):
if isinstance(data, str):
data = data.encode('utf-8')
return data + b'\n'
return bytes(data)
return b'' if data is None else bytes(data)
ASCII_CHARS = frozenset(codepoint_to_chr(x) for x in range(128))