From ab5ec510bf5531482230ba6e9e17a9af7e9caeb5 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 3 Oct 2012 08:16:41 -0600 Subject: [PATCH] handle zero length arrays properly in JNIEnv::NewString --- src/jnienv.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/jnienv.cpp b/src/jnienv.cpp index 9e1d7e9edf..52da9559f7 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -241,9 +241,8 @@ newString(Thread* t, uintptr_t* arguments) const jchar* chars = reinterpret_cast(arguments[0]); jsize size = arguments[1]; - object a = 0; + object a = makeCharArray(t, size); if (size) { - a = makeCharArray(t, size); memcpy(&charArrayBody(t, a, 0), chars, size * sizeof(jchar)); }