aboutsummaryrefslogtreecommitdiff
path: root/libjava/jni.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r--libjava/jni.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/libjava/jni.cc b/libjava/jni.cc
index d311f60..007aabc 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';