From e8be0adf3727f73877d8170a5958d1ab767c90c6 Mon Sep 17 00:00:00 2001 From: Robert Gingras Date: Tue, 23 Apr 2024 15:25:38 -0400 Subject: [PATCH] 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 --- .../tagreadertaglib.cpp | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/ext/libstrawberry-tagreader/tagreadertaglib.cpp b/ext/libstrawberry-tagreader/tagreadertaglib.cpp index 8645ad97..2b5b15bb 100644 --- a/ext/libstrawberry-tagreader/tagreadertaglib.cpp +++ b/ext/libstrawberry-tagreader/tagreadertaglib.cpp @@ -989,21 +989,18 @@ bool TagReaderTagLib::SaveFile(const spb::tagreader::SaveFileRequest &request) c } else if (TagLib::RIFF::WAV::File *file_wav = dynamic_cast(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); } }