Fix reading empty ID3v1 fields
This commit is contained in:
parent
92e80a9286
commit
a6ca3183b3
|
@ -279,10 +279,13 @@ void Id3v1Tag::ensureTextValuesAreProperlyEncoded()
|
||||||
void Id3v1Tag::readValue(TagValue &value, size_t maxLength, const char *buffer)
|
void Id3v1Tag::readValue(TagValue &value, size_t maxLength, const char *buffer)
|
||||||
{
|
{
|
||||||
const char *end = buffer + maxLength - 1;
|
const char *end = buffer + maxLength - 1;
|
||||||
while ((*end == 0x0 || *end == ' ') && end > buffer) {
|
while ((*end == 0x0 || *end == ' ') && end >= buffer) {
|
||||||
--end;
|
--end;
|
||||||
--maxLength;
|
--maxLength;
|
||||||
}
|
}
|
||||||
|
if (buffer == end) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (maxLength >= 3 && BE::toUInt24(buffer) == 0x00EFBBBF) {
|
if (maxLength >= 3 && BE::toUInt24(buffer) == 0x00EFBBBF) {
|
||||||
value.assignData(buffer + 3, maxLength - 3, TagDataType::Text, TagTextEncoding::Utf8);
|
value.assignData(buffer + 3, maxLength - 3, TagDataType::Text, TagTextEncoding::Utf8);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue