musikr.metadata: attempt to fix jni null error
This commit is contained in:
@@ -21,6 +21,9 @@
|
|||||||
JByteArrayRef::JByteArrayRef(JNIEnv *env, TagLib::ByteVector &data) : env(env) {
|
JByteArrayRef::JByteArrayRef(JNIEnv *env, TagLib::ByteVector &data) : env(env) {
|
||||||
auto size = static_cast<jsize>(data.size());
|
auto size = static_cast<jsize>(data.size());
|
||||||
array = env->NewByteArray(size);
|
array = env->NewByteArray(size);
|
||||||
|
if (array == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
env->SetByteArrayRegion(array, 0, static_cast<jsize>(size),
|
env->SetByteArrayRegion(array, 0, static_cast<jsize>(size),
|
||||||
reinterpret_cast<const jbyte*>(data.data()));
|
reinterpret_cast<const jbyte*>(data.data()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user