Don't error out on an empty tag

This commit is contained in:
Serial 2021-07-19 13:30:24 -04:00
parent e1c02113ff
commit d2a6e35537
2 changed files with 4 additions and 4 deletions

View file

@ -27,7 +27,7 @@ impl ApeTag {
R: Read + Seek,
{
Ok(Self {
inner: ape::read_from(reader)?,
inner: ape::read_from(reader).unwrap_or_else(|| ape::Tag::new()),
_format: TagType::Ape,
})
}

View file

@ -30,15 +30,15 @@ impl Id3v2Tag {
{
match format {
Id3Format::Mp3 => Ok(Self {
inner: Id3v2InnerTag::read_from(reader)?,
inner: Id3v2InnerTag::read_from(reader).unwrap_or_else(|| Id3v2InnerTag::new()),
_format: TagType::Id3v2(format),
}),
Id3Format::Riff => Ok(Self {
inner: Id3v2InnerTag::read_from_wav_reader(reader)?,
inner: Id3v2InnerTag::read_from_wav_reader(reader).unwrap_or_else(|| Id3v2InnerTag::new()),
_format: TagType::Id3v2(format),
}),
Id3Format::Aiff => Ok(Self {
inner: Id3v2InnerTag::read_from_aiff_reader(reader)?,
inner: Id3v2InnerTag::read_from_aiff_reader(reader).unwrap_or_else(|| Id3v2InnerTag::new()),
_format: TagType::Id3v2(format),
}),
}