--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp Wed Mar 30 22:02:23 2016 +0000
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp Mon Apr 04 15:48:28 2016 +0300
@@ -256,7 +256,7 @@
AwtFont* awtFont = NULL;
jobjectArray compFont = NULL;
- int cfnum;
+ int cfnum = 0;
try {
if (env->EnsureLocalCapacity(3) < 0)
@@ -264,7 +264,9 @@
if (IsMultiFont(env, font)) {
compFont = GetComponentFonts(env, font);
- cfnum = env->GetArrayLength(compFont);
+ if (compFont != NULL) {
+ cfnum = env->GetArrayLength(compFont);
+ }
} else {
compFont = NULL;
cfnum = 0;
@@ -647,7 +649,9 @@
if (IsMultiFont(env, font)) {
array = GetComponentFonts(env, font);
- num = env->GetArrayLength(array);
+ if (array != NULL) {
+ num = env->GetArrayLength(array);
+ }
} else {
array = NULL;
num = 0;
@@ -705,14 +709,16 @@
if (IsMultiFont(env, font)) {
jobject peer = env->CallObjectMethod(font, AwtFont::peerMID);
- array = (jobjectArray)(env->CallObjectMethod(
- peer, AwtFont::makeConvertedMultiFontStringMID, str));
- DASSERT(!safe_ExceptionOccurred(env));
+ if (peer != NULL) {
+ array = (jobjectArray)(env->CallObjectMethod(
+ peer, AwtFont::makeConvertedMultiFontStringMID, str));
+ DASSERT(!safe_ExceptionOccurred(env));
- if (array != NULL) {
- arrayLength = env->GetArrayLength(array);
+ if (array != NULL) {
+ arrayLength = env->GetArrayLength(array);
+ }
+ env->DeleteLocalRef(peer);
}
- env->DeleteLocalRef(peer);
} else {
array = NULL;
arrayLength = 0;
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.h Wed Mar 30 22:02:23 2016 +0000
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.h Mon Apr 04 15:48:28 2016 +0300
@@ -230,11 +230,14 @@
INLINE static jobjectArray GetComponentFonts(JNIEnv *env,
jobject font) {
jobject platformFont = env->CallObjectMethod(font, AwtFont::peerMID);
- jobjectArray result =
- (jobjectArray)(env->GetObjectField(platformFont,
- AwtFont::componentFontsID));
- env->DeleteLocalRef(platformFont);
- return result;
+ if (platformFont != NULL) {
+ jobjectArray result =
+ (jobjectArray)(env->GetObjectField(platformFont,
+ AwtFont::componentFontsID));
+ env->DeleteLocalRef(platformFont);
+ return result;
+ }
+ return NULL;
}
/*