diff --git a/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m b/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m index cf081379120..d2e12cfc70c 100644 --- a/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m +++ b/jdk/src/macosx/native/sun/font/CCharToGlyphMapper.m @@ -101,10 +101,13 @@ JNF_COCOA_ENTER(env); 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); }