Extra protection

Fixes https://github.com/fonttools/fonttools/issues/797
Although for the XML->binary case, that bug was already fixed
on master because of the XML populate-default changes.
This adds extra protection!
This commit is contained in:
Behdad Esfahbod 2017-01-08 23:47:29 -08:00
parent 80535c224e
commit e4d88b5a38

View File

@ -206,7 +206,7 @@ class VarData(BaseTable):
numShorts = 0 numShorts = 0
count = len(self.VarRegionIndex) count = len(self.VarRegionIndex)
for item in self.Item: for item in getattr(self, Item, []):
assert len(item) == count, ("Item length mismatch", len(item), count) assert len(item) == count, ("Item length mismatch", len(item), count)
for i in range(count - 1, numShorts - 1, -1): for i in range(count - 1, numShorts - 1, -1):
if not (-128 <= item[i] <= 127): if not (-128 <= item[i] <= 127):