6852607: MessageUtils JVM crash

Fixes crash by checking null field

Reviewed-by: alanb
This commit is contained in:
Lillian Angel 2009-06-25 17:01:56 -04:00
parent 1ece67558e
commit 9feab8fb3a

View File

@ -39,6 +39,11 @@ printToFile(JNIEnv *env, jstring s, FILE *file)
int i;
const jchar *sAsArray;
if (s == NULL) {
s = (*env)->NewStringUTF(env, "null");
if (s == NULL) return;
}
sAsArray = (*env)->GetStringChars(env, s, NULL);
length = (*env)->GetStringLength(env, s);
sConverted = (char *) malloc(length + 1);