diff --git a/mpeg/id3v2/frames/textidentificationframe.cpp b/mpeg/id3v2/frames/textidentificationframe.cpp index c4bb339a..d2cebc12 100644 --- a/mpeg/id3v2/frames/textidentificationframe.cpp +++ b/mpeg/id3v2/frames/textidentificationframe.cpp @@ -165,7 +165,7 @@ UserTextIdentificationFrame::UserTextIdentificationFrame(String::Type encoding) UserTextIdentificationFrame::UserTextIdentificationFrame(const ByteVector &data) : TextIdentificationFrame(data) { - + checkFields(); } String UserTextIdentificationFrame::toString() const @@ -182,14 +182,9 @@ String UserTextIdentificationFrame::description() const StringList UserTextIdentificationFrame::fieldList() const { - StringList l = TextIdentificationFrame::fieldList(); + // TODO: remove this function - if(!l.isEmpty()) { - StringList::Iterator it = l.begin(); - l.erase(it); - } - - return l; + return TextIdentificationFrame::fieldList(); } void UserTextIdentificationFrame::setText(const String &text) @@ -238,5 +233,15 @@ UserTextIdentificationFrame *UserTextIdentificationFrame::find(ID3v2::Tag *tag, UserTextIdentificationFrame::UserTextIdentificationFrame(const ByteVector &data, Header *h) : TextIdentificationFrame(data, h) { - + checkFields(); +} + +void UserTextIdentificationFrame::checkFields() +{ + int fields = fieldList().size(); + + if(fields == 0) + setDescription(String::null); + if(fields <= 1) + setText(String::null); } diff --git a/mpeg/id3v2/frames/textidentificationframe.h b/mpeg/id3v2/frames/textidentificationframe.h index 00c13851..48b5bd55 100644 --- a/mpeg/id3v2/frames/textidentificationframe.h +++ b/mpeg/id3v2/frames/textidentificationframe.h @@ -232,6 +232,8 @@ namespace TagLib { UserTextIdentificationFrame(const TextIdentificationFrame &); UserTextIdentificationFrame &operator=(const UserTextIdentificationFrame &); + void checkFields(); + class UserTextIdentificationFramePrivate; UserTextIdentificationFramePrivate *d; };