diff options
author | Tom Tromey <tromey@redhat.com> | 2003-11-18 17:56:33 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2003-11-18 17:56:33 +0000 |
commit | 6c363de7eafedfede9e3eb57352bf2ba16047e6d (patch) | |
tree | 5563e6839de77f226986a446f01a44992d6c0531 /libjava/jni.cc | |
parent | b9c5315018a258574309d05df7f092868b508eae (diff) | |
download | gcc-6c363de7eafedfede9e3eb57352bf2ba16047e6d.tar.gz |
jni.cc (_Jv_JNI_GetStringUTFChars): Fail gracefully if string is null.
* jni.cc (_Jv_JNI_GetStringUTFChars): Fail gracefully if string
is null.
From-SVN: r73707
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r-- | libjava/jni.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libjava/jni.cc b/libjava/jni.cc index d311f60ff1c..007aabc4008 100644 --- a/libjava/jni.cc +++ b/libjava/jni.cc @@ -1298,10 +1298,12 @@ static const char * (JNICALL _Jv_JNI_GetStringUTFChars) (JNIEnv *env, jstring string, jboolean *isCopy) { - string = unwrap (string); - jsize len = JvGetStringUTFLength (string); try { + string = unwrap (string); + if (string == NULL) + return NULL; + jsize len = JvGetStringUTFLength (string); char *r = (char *) _Jv_Malloc (len + 1); JvGetStringUTFRegion (string, 0, string->length(), r); r[len] = '\0'; |