Fix #1969981 [Conversion to PDF fails with "TypeError: '<=' not supported between instances of 'str' and 'float'"](https://bugs.launchpad.net/calibre/+bug/1969981)

This commit is contained in:
Kovid Goyal 2022-04-23 07:11:12 +05:30
parent 69ab397165
commit 86373bac9b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -338,9 +338,9 @@ class CSSFlattener:
if '%' in cssdict[property]:
continue
value = style[property]
if value == 0:
if value == 0 or not isinstance(value, numbers.Number):
continue
elif value <= slineh:
if value <= slineh:
cssdict[property] = "%0.5fem" % (dlineh / fsize)
else:
try: