musikr: handle possible null pointers in id3v2

This commit is contained in:
Alexander Capehart
2025-01-07 10:02:28 -07:00
parent 447f2da294
commit 605800e9a5
+4 -1
View File
@@ -35,11 +35,14 @@ void JVMMetadataBuilder::setMimeType(const std::string_view type) {
void JVMMetadataBuilder::setId3v2(const TagLib::ID3v2::Tag &tag) {
for (auto frame : tag.frameList()) {
if (frame == nullptr)
continue;
if (auto txxxFrame =
dynamic_cast<TagLib::ID3v2::UserTextIdentificationFrame*>(frame)) {
TagLib::String id = frame->frameID();
TagLib::StringList frameText = txxxFrame->fieldList();
// Frame text starts with the description then the remaining values
if (frameText.isEmpty())
continue;
auto begin = frameText.begin();
TagLib::String description = *begin;
frameText.erase(begin);