From 139d89bb7f7dd86d862608f39e90b34803a48753 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 12 Feb 2023 00:16:25 +0100 Subject: TTFont: Handle null result of _glyf.getDescription(i) --- src/main/java/net/java/dev/typecast/ot/TTFont.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/java/dev/typecast/ot/TTFont.java b/src/main/java/net/java/dev/typecast/ot/TTFont.java index 4505f1b..c8ac6bd 100644 --- a/src/main/java/net/java/dev/typecast/ot/TTFont.java +++ b/src/main/java/net/java/dev/typecast/ot/TTFont.java @@ -164,11 +164,17 @@ public class TTFont extends OTFont { return _vdmx; } - public Glyph getGlyph(int i) { - return new TTGlyph( - _glyf.getDescription(i), - getHmtxTable().getLeftSideBearing(i), - getHmtxTable().getAdvanceWidth(i)); + @Override + public Glyph getGlyph(final int i) { + final GlyfDescript glyfDescr = _glyf.getDescription(i); + if( null != glyfDescr ) { + return new TTGlyph( + glyfDescr, + getHmtxTable().getLeftSideBearing(i), + getHmtxTable().getAdvanceWidth(i)); + } else { + return null; + } } } -- cgit v1.2.3