Add exception checks

This commit is contained in:
ylecollen 2017-01-03 11:04:06 +01:00
parent c8c7a8ad19
commit 5e948b1ac4

View file

@ -62,7 +62,7 @@ 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) if (newObj && tempByteArray && !env->ExceptionOccurred())
{ {
env->CallVoidMethod(newObj, nextByteMethod, tempByteArray); env->CallVoidMethod(newObj, nextByteMethod, tempByteArray);
jbyte* buffer = env->GetByteArrayElements(tempByteArray, NULL); jbyte* buffer = env->GetByteArrayElements(tempByteArray, NULL);