diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index c02dfe9e34..3c12a28080 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -475,9 +475,10 @@ class CSSFlattener(object): try: minlh = self.context.minimum_line_height / 100. - if not is_drop_cap and style['line-height'] < minlh * fsize: + slh = style['line-height'] + if not is_drop_cap and isinstance(slh, numbers.Number) and slh < minlh * fsize: cssdict['line-height'] = unicode_type(minlh) - except: + except Exception: self.oeb.logger.exception('Failed to set minimum line-height') if cssdict: diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py index e4834f7ea8..dbe6dfe9db 100644 --- a/src/calibre/ebooks/txt/processor.py +++ b/src/calibre/ebooks/txt/processor.py @@ -240,7 +240,7 @@ def split_string_separator(txt, size): ''' Splits the text by putting \n\n at the point size. ''' - if len(txt) > size: + if len(txt) > size and size > 2: size -= 2 txt = [] for part in (txt[i * size: (i + 1) * size] for i in range(0, len(txt), size)):