Commit eec8a50c authored by ylecollen's avatar ylecollen
Browse files

Move the exception test

parent 90c55806
...@@ -62,9 +62,12 @@ bool setRandomInBuffer(JNIEnv *env, uint8_t **aBuffer2Ptr, size_t aRandomSize) ...@@ -62,9 +62,12 @@ bool setRandomInBuffer(JNIEnv *env, uint8_t **aBuffer2Ptr, size_t aRandomSize)
newObj = env->NewObject(cls, constructor); newObj = env->NewObject(cls, constructor);
jbyteArray tempByteArray = env->NewByteArray(bufferLen); jbyteArray tempByteArray = env->NewByteArray(bufferLen);
if (newObj && tempByteArray && !env->ExceptionOccurred()) if (newObj && tempByteArray)
{ {
env->CallVoidMethod(newObj, nextByteMethod, tempByteArray); env->CallVoidMethod(newObj, nextByteMethod, tempByteArray);
if (!env->ExceptionOccurred())
{
jbyte* buffer = env->GetByteArrayElements(tempByteArray, NULL); jbyte* buffer = env->GetByteArrayElements(tempByteArray, NULL);
if (buffer) if (buffer)
...@@ -80,6 +83,7 @@ bool setRandomInBuffer(JNIEnv *env, uint8_t **aBuffer2Ptr, size_t aRandomSize) ...@@ -80,6 +83,7 @@ bool setRandomInBuffer(JNIEnv *env, uint8_t **aBuffer2Ptr, size_t aRandomSize)
env->ReleaseByteArrayElements(tempByteArray, buffer, JNI_ABORT); env->ReleaseByteArrayElements(tempByteArray, buffer, JNI_ABORT);
} }
} }
}
if (tempByteArray) if (tempByteArray)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment