From f09a9768e97a5fbe3a61fa5580bb069cd2dd11bc Mon Sep 17 00:00:00 2001 From: mbaesken Date: Fri, 18 Oct 2019 14:56:01 +0200 Subject: [PATCH] 8232381: add result NULL-checking to freetypeScaler.c 8231129: More glyph images Reviewed-by: clanger, prr --- src/share/native/sun/font/freetypeScaler.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/share/native/sun/font/freetypeScaler.c b/src/share/native/sun/font/freetypeScaler.c index c98db1e36..bc3a905ba 100644 --- a/src/share/native/sun/font/freetypeScaler.c +++ b/src/share/native/sun/font/freetypeScaler.c @@ -675,10 +675,14 @@ Java_sun_font_FreetypeFontScaler_getGlyphMetricsNative( pScalerContext, pScaler, glyphCode); info = (GlyphInfo*) jlong_to_ptr(image); - (*env)->SetFloatField(env, metrics, sunFontIDs.xFID, info->advanceX); - (*env)->SetFloatField(env, metrics, sunFontIDs.yFID, info->advanceY); - - free(info); + if (info != NULL) { + (*env)->SetFloatField(env, metrics, sunFontIDs.xFID, info->advanceX); + (*env)->SetFloatField(env, metrics, sunFontIDs.yFID, info->advanceY); + free(info); + } else { + (*env)->SetFloatField(env, metrics, sunFontIDs.xFID, 0.0f); + (*env)->SetFloatField(env, metrics, sunFontIDs.yFID, 0.0f); + } } -- GitLab