From beb4a2d910c4534ed10dfbb9a895acb89ed54822 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 14 Apr 2023 06:23:58 +0200 Subject: Graph TypecastFont: Avoid PostTable (out-of-bounds) for glyph_name when not even a Glyph was mapped to the ID --- src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/jogl/classes/jogamp/graph') diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index cc0aece27..26952ce9a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -193,9 +193,13 @@ class TypecastFont implements Font { TypecastGlyph result = (TypecastGlyph) idToGlyph.get(glyph_id); if (null == result) { final jogamp.graph.font.typecast.ot.Glyph glyph = font.getGlyph(glyph_id); - final PostTable post = font.getPostTable(); - final String glyph_name = null != post ? post.getGlyphName(glyph_id) : ""; - + final String glyph_name; + if( null != glyph ) { + final PostTable post = font.getPostTable(); + glyph_name = null != post ? post.getGlyphName(glyph_id) : ""; + } else { + glyph_name = ""; + } final int glyph_advance; final int glyph_leftsidebearings; final AABBox glyph_bbox; -- cgit v1.2.3