diff options
-rw-r--r-- | src/main/java/net/java/dev/typecast/ot/table/GlyfCompositeDescript.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/main/java/net/java/dev/typecast/ot/table/GlyfCompositeDescript.java b/src/main/java/net/java/dev/typecast/ot/table/GlyfCompositeDescript.java index 4adcca5..8ff6fc5 100644 --- a/src/main/java/net/java/dev/typecast/ot/table/GlyfCompositeDescript.java +++ b/src/main/java/net/java/dev/typecast/ot/table/GlyfCompositeDescript.java @@ -176,7 +176,8 @@ public class GlyfCompositeDescript extends GlyfDescript { @Override public int getContourCount() { final GlyfCompositeComp last = lastComponent(); - return last.getFirstContour() + getReferencedGlyph(last).getContourCount(); + final GlyfDescript lastD = getReferencedGlyph(last); + return last.getFirstContour() + ( null != lastD ? lastD.getContourCount() : 0 ); } private GlyfCompositeComp lastComponent() { @@ -206,24 +207,24 @@ public class GlyfCompositeDescript extends GlyfDescript { } private GlyfCompositeComp getCompositeComp(final int i) { - GlyfCompositeComp c; - for (final GlyfCompositeComp component : _components) { - c = component; + for (final GlyfCompositeComp c : _components) { final GlyphDescription gd = getReferencedGlyph(c); - if (c.getFirstIndex() <= i && i < (c.getFirstIndex() + gd.getPointCount())) { - return c; + if( null != gd ) { + if (c.getFirstIndex() <= i && i < (c.getFirstIndex() + gd.getPointCount())) { + return c; + } } } return null; } private GlyfCompositeComp getCompositeCompEndPt(final int i) { - GlyfCompositeComp c; - for (final GlyfCompositeComp component : _components) { - c = component; + for (final GlyfCompositeComp c : _components) { final GlyphDescription gd = getReferencedGlyph(c); - if (c.getFirstContour() <= i && i < (c.getFirstContour() + gd.getContourCount())) { - return c; + if( null != gd ) { + if (c.getFirstContour() <= i && i < (c.getFirstContour() + gd.getContourCount())) { + return c; + } } } return null; |