Skip to content

Commit 81d8a2d

Browse files
committed
Don’t crash if there isn’t a GDEF table
1 parent 195a4ab commit 81d8a2d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

ttj/src/context.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ pub(crate) struct SerializationContext<'a> {
1515

1616
impl<'a> SerializationContext<'a> {
1717
pub fn new(font: &'a FontRef<'a>, names: NameMap) -> Result<Self, ReadError> {
18-
let (gdef_regions, gdef_locations) = if let Some(Ok(ivs)) = font.gdef()?.item_var_store() {
18+
let (gdef_regions, gdef_locations) = if let Ok(Some(ivs)) = font
19+
.gdef()
20+
.and_then(|gdef| gdef.item_var_store().transpose())
21+
{
1922
let regions = ivs.variation_region_list()?.variation_regions();
2023

2124
// Find all the peaks

0 commit comments

Comments
 (0)