--- a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c Fri Oct 18 14:15:10 2019 +0800
+++ b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c Fri Oct 18 14:56:01 2019 +0200
@@ -673,10 +673,14 @@
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);
+ }
}