From e74645e833872d464a01c9565680fa86f3fa7ead Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 13 Jul 2018 12:37:21 +0200 Subject: [PATCH] Handle unknown short IDs correctly when comparing ID3v2 frame IDs --- id3/id3v2tag.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/id3/id3v2tag.cpp b/id3/id3v2tag.cpp index 35cee43..12418e4 100644 --- a/id3/id3v2tag.cpp +++ b/id3/id3v2tag.cpp @@ -500,7 +500,8 @@ void Id3v2Tag::setVersion(byte majorVersion, byte revisionVersion) /*! * \brief Returns true if \a lhs goes before \a rhs; otherwise returns false. - * \todo Handle case when Id3v2FrameIds::convertToLongId() returns 0. + * \remarks Long and short IDs are treated equal if the short ID can be converted to + * the corresponding long ID. Otherwise short IDs go before long IDs. */ bool FrameComparer::operator()(uint32 lhs, uint32 rhs) const { @@ -513,8 +514,14 @@ bool FrameComparer::operator()(uint32 lhs, uint32 rhs) const if (lhsLong != rhsLong) { if (!lhsLong) { lhs = Id3v2FrameIds::convertToLongId(lhs); + if (!lhs) { + return true; + } } else if (!rhsLong) { rhs = Id3v2FrameIds::convertToLongId(rhs); + if (!rhs) { + return true; + } } }