[subset] Add a couple None checks

Exercised by Simon's Gulzar
This commit is contained in:
Behdad Esfahbod 2021-10-01 11:42:58 -06:00
parent b4a789ee9e
commit 76ac638c43

View File

@ -1018,7 +1018,7 @@ def closure_glyphs(self, s, cur_glyphs):
chaos.update(range(seqi, len(getattr(r, c.Input))+2)) chaos.update(range(seqi, len(getattr(r, c.Input))+2))
lookup.closure_glyphs(s, cur_glyphs=pos_glyphs) lookup.closure_glyphs(s, cur_glyphs=pos_glyphs)
elif self.Format == 3: elif self.Format == 3:
if not all(x.intersect(s.glyphs) for x in c.RuleData(self)): if not all(x is not None and x.intersect(s.glyphs) for x in c.RuleData(self)):
return [] return []
r = self r = self
input_coverages = getattr(r, c.Input) input_coverages = getattr(r, c.Input)
@ -1113,7 +1113,7 @@ def subset_glyphs(self, s):
return bool(rss) return bool(rss)
elif self.Format == 3: elif self.Format == 3:
return all(x.subset(s.glyphs) for x in c.RuleData(self)) return all(x is not None and x.subset(s.glyphs) for x in c.RuleData(self))
else: else:
assert 0, "unknown format: %s" % self.Format assert 0, "unknown format: %s" % self.Format