8034119: [parfait] JNI exception pending in jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m

Reviewed-by: serb, jgodinez
diff --git a/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m b/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m
index cf08137..d2e12cf 100644
--- a/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m
+++ b/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m
@@ -101,10 +101,13 @@
     jchar *unicodesAsChars =
         (*env)->GetPrimitiveArrayCritical(env, unicodes, NULL);
 
-    AllocateGlyphBuffer(env, awtFont, count, (UniChar *)unicodesAsChars, glyphs);
+    if (unicodesAsChars != NULL) {
+        AllocateGlyphBuffer(env, awtFont, count,
+                           (UniChar *)unicodesAsChars, glyphs);
 
-    (*env)->ReleasePrimitiveArrayCritical(env, unicodes,
-                                          unicodesAsChars, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, unicodes,
+                                              unicodesAsChars, JNI_ABORT);
+    }
 
 JNF_COCOA_EXIT(env);
 }