Merge pull request #883 from anthrotype/fix-empty-cff-delta

[cffLib/psCharStrings] fix IndexError with empty deltas
This commit is contained in:
Cosimo Lupo 2017-03-09 19:39:54 +00:00 committed by GitHub
commit f662391091
2 changed files with 5 additions and 2 deletions

View File

@ -1086,7 +1086,7 @@ class NumberConverter(SimpleConverter):
class ArrayConverter(SimpleConverter):
def xmlWrite(self, xmlWriter, name, value, progress):
if isinstance(value[0], list):
if value and isinstance(value[0], list):
xmlWriter.begintag(name)
xmlWriter.newline()
xmlWriter.indent()
@ -1907,6 +1907,8 @@ class DictCompiler(object):
data.append(self.arg_number(num))
return bytesjoin(data)
def arg_delta(self, value):
if not value:
return b""
val0 = value[0]
if isinstance(val0, list):
data = self.arg_delta_blend(value)

View File

@ -1319,7 +1319,8 @@ class DictDecompiler(ByteCodeBase):
def arg_delta(self, name):
valueList = self.popall()
out = []
if isinstance(valueList[0], list): # arg_blendList() has already converted these to absolute values.
if valueList and isinstance(valueList[0], list):
# arg_blendList() has already converted these to absolute values.
out = valueList
else:
current = 0