newIntArray() may fail

Allocation of the integer array may fail, guard against NPE.

Change-Id: I3e860153597638392c9b669a6ad586fd2e03a64d
Signed-off-by: Robert Varga <nite@hq.sk>
This commit is contained in:
Robert Varga
2016-02-10 16:00:16 +01:00
parent 20abdd9b02
commit ec3034c2ba

View File

@ -894,11 +894,14 @@ static jintArray create_array_of_bd_ids(JNIEnv * env, jint bd_id)
}
jintArray bdidArray = (*env)->NewIntArray(env, vec_len(buf));
if (!bdidArray) {
goto out;
}
(*env)->SetIntArrayRegion(env, bdidArray, 0, vec_len(buf), (int*)buf);
out:
vec_free(buf);
return bdidArray;
}