MOBI Input: Don't error out when detecting TOC structure if one of the elements has an invalid margin unit

This commit is contained in:
Kovid Goyal 2011-05-15 12:35:54 -06:00
parent 997a943257
commit 010b2e8081

View File

@ -690,6 +690,14 @@ class MobiReader(object):
lm = unit_convert('2em', 12, 500, 166)
lm = self.left_margins.get(tag, lm)
ti = self.text_indents.get(tag, ti)
try:
lm = float(lm)
except:
lm = 0.0
try:
ti = float(ti)
except:
ti = 0.0
return lm + ti
parent = tag