diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-11-22 10:09:50 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-11-22 10:09:50 +0200 |
commit | fc089685f7e3575931713224aff310f0f4a20be4 (patch) | |
tree | 1771f2b3ceabd9b9a467db91e27230e27e24fe2a /src | |
parent | 4bda5013895048b346f7592caeebb07e4954859e (diff) |
libjvm-java: handle null string
Diffstat (limited to 'src')
-rw-r--r-- | src/libjvm-java.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libjvm-java.c b/src/libjvm-java.c index baa3e29..fb1d81b 100644 --- a/src/libjvm-java.c +++ b/src/libjvm-java.c @@ -168,7 +168,7 @@ java_lang_String_getBytes(JNIEnv *env, jobject object, va_list args) { assert(env && object); const char *utf = (*env)->GetStringUTFChars(env, object, NULL); - const size_t len = strlen(utf); + const size_t len = (utf ? strlen(utf) : 0); jbyteArray bytes = (*env)->NewByteArray(env, len); (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)utf); return bytes; |