TagReaderTagLib: Remove redundant ID3v2 validity check

TagLib will have created a valid ID3v2 tag on this file by this point in the code, due to the way it handles the tag() method for WAV::File. Thus the null pointer check is redundant and the hasID3v2() call is at best redundant and at worst will cause tags to not save when they otherwise should have
This commit is contained in:
Robert Gingras 2024-04-23 15:25:38 -04:00
parent 20f01c3f8d
commit 05dfd20c88
1 changed files with 12 additions and 15 deletions

View File

@ -989,21 +989,18 @@ bool TagReaderTagLib::SaveFile(const spb::tagreader::SaveFileRequest &request) c
}
else if (TagLib::RIFF::WAV::File *file_wav = dynamic_cast<TagLib::RIFF::WAV::File*>(fileref->file())) {
if (file_wav->hasID3v2Tag()) {
TagLib::ID3v2::Tag *tag = file_wav->ID3v2Tag();
if (!tag) return false;
if (save_tags) {
SaveID3v2Tag(tag, song);
}
if (save_playcount) {
SetPlaycount(tag, song);
}
if (save_rating) {
SetRating(tag, song);
}
if (save_cover) {
SetEmbeddedArt(tag, cover.data, cover.mime_type);
}
TagLib::ID3v2::Tag *tag = file_wav->ID3v2Tag();
if (save_tags) {
SaveID3v2Tag(tag, song);
}
if (save_playcount) {
SetPlaycount(tag, song);
}
if (save_rating) {
SetRating(tag, song);
}
if (save_cover) {
SetEmbeddedArt(tag, cover.data, cover.mime_type);
}
}