Skip to content

Commit 97facb7

Browse files
khaledhosnyfelipesanches
authored andcommitted
Check ttFont["GDEF"].table.GlyphClassDef before accessing its members
It can be None.
1 parent 31e9498 commit 97facb7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/fontbakery/profiles/universal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ def com_google_fonts_check_legacy_accents(ttFont):
746746
# Check whether legacy accents appear in GDEF as marks.
747747
# Not being marks in GDEF also typically means that they don't have anchors,
748748
# as font compilers would have otherwise classified them as marks in GDEF.
749-
if "GDEF" in ttFont:
749+
if "GDEF" in ttFont and ttFont["GDEF"].table.GlyphClassDef:
750750
class_def = ttFont["GDEF"].table.GlyphClassDef.classDefs
751751
for glyph in font.glyphs:
752752
if set(glyph.codepoints).intersection(LEGACY_ACCENTS):
@@ -804,7 +804,7 @@ def com_google_fonts_check_arabic_spacing_symbols(ttFont):
804804
passed = True
805805
font = babelfont.load(ttFont.reader.file.name)
806806

807-
if "GDEF" in ttFont:
807+
if "GDEF" in ttFont and ttFont["GDEF"].table.GlyphClassDef:
808808
class_def = ttFont["GDEF"].table.GlyphClassDef.classDefs
809809
for glyph in font.glyphs:
810810
if set(glyph.codepoints).intersection(ARABIC_SPACING_SYMBOLS):
@@ -856,7 +856,7 @@ def com_google_fonts_check_arabic_high_hamza(ttFont):
856856
passed = True
857857
font = babelfont.load(ttFont.reader.file.name)
858858

859-
if "GDEF" in ttFont:
859+
if "GDEF" in ttFont and ttFont["GDEF"].table.GlyphClassDef:
860860
class_def = ttFont["GDEF"].table.GlyphClassDef.classDefs
861861
for glyph in font.glyphs:
862862
if ARABIC_LETTER_HIGH_HAMZA in set(glyph.codepoints):

0 commit comments

Comments
 (0)