changeset 13785:af4b3b1ccc20

8232381: add result NULL-checking to freetypeScaler.c 8231129: More glyph images Reviewed-by: clanger, prr
author mbaesken
date Fri, 18 Oct 2019 14:56:01 +0200
parents decb51098c77
children c1a3bd525431
files src/share/native/sun/font/freetypeScaler.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/font/freetypeScaler.c	Wed Oct 23 17:20:02 2019 +0000
+++ b/src/share/native/sun/font/freetypeScaler.c	Fri Oct 18 14:56:01 2019 +0200
@@ -675,10 +675,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);
+     }
 }