musikr: handle possible null pointers in id3v2
This commit is contained in:
parent
447f2da294
commit
605800e9a5
1 changed files with 4 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue