Skip to content

Commit

Permalink
handle zero length arrays properly in JNIEnv::NewString
Browse files Browse the repository at this point in the history
  • Loading branch information
dicej committed Oct 3, 2012
1 parent 2a15201 commit ab5ec51
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/jnienv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,8 @@ newString(Thread* t, uintptr_t* arguments)
const jchar* chars = reinterpret_cast<const jchar*>(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));
}

Expand Down

0 comments on commit ab5ec51

Please sign in to comment.