musikr.metadata: throw on alloc failure

This commit is contained in:
Alexander Capehart
2025-11-21 10:28:01 -07:00
parent bbbd75dd21
commit 029ddeca61
+1 -1
View File
@@ -22,7 +22,7 @@ JByteArrayRef::JByteArrayRef(JNIEnv *env, TagLib::ByteVector &data) : env(env) {
auto size = static_cast<jsize>(data.size());
array = env->NewByteArray(size);
if (array == nullptr) {
return;
throw std::runtime_error("array failed to allocate");
}
env->SetByteArrayRegion(array, 0, static_cast<jsize>(size),
reinterpret_cast<const jbyte*>(data.data()));