musikr.metadata: throw on alloc failure
This commit is contained in:
@@ -22,7 +22,7 @@ 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) {
|
if (array == nullptr) {
|
||||||
return;
|
throw std::runtime_error("array failed to allocate");
|
||||||
}
|
}
|
||||||
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