derpface
derpface

Reputation: 1691

When does GetByteArrayElements return null?

I'm using JNI/NDK to tie in some C++ libraries with an Android app. One of the Java methods uses a byte array, so I need to call GetByteArrayElements in the JNI bindings. In what cases does GetByteArrayElements return NULL? Oracle's documentation simply states:

Returns a pointer to the array elements, or NULL if the operation fails.

What cases can cause the operation to fail and return NULL?

Upvotes: 2

Views: 1389

Answers (1)

user207421
user207421

Reputation: 310985

It returns NULL if the operation fails, and not otherwise, including your case of an empty array.

Upvotes: 1

Related Questions