aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormbaesken <unknown>2019-10-18 14:56:01 +0200
committerbell-sw <liberica@bell-sw.com>2020-01-19 09:13:22 +0300
commit25d05e980ec33f83e4fe613ce007c6bac9c21b20 (patch)
tree72baff516cbe2a5fbae6d46b0ca81633fd66630b
parent7eb5b7406574fa231fcd25ffc51ca8a1bdf2cba4 (diff)
downloadjdk8u_jdk-25d05e980ec33f83e4fe613ce007c6bac9c21b20.tar.gz
8232381: add result NULL-checking to freetypeScaler.c
8231129: More glyph images Reviewed-by: clanger, prr
-rw-r--r--src/share/native/sun/font/freetypeScaler.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/share/native/sun/font/freetypeScaler.c b/src/share/native/sun/font/freetypeScaler.c
index 188daaba46..65c24d42d2 100644
--- a/src/share/native/sun/font/freetypeScaler.c
+++ b/src/share/native/sun/font/freetypeScaler.c
@@ -1140,10 +1140,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);
+ }
}