From d2a6e35537e1d0eb34ece933b046b23b340f6599 Mon Sep 17 00:00:00 2001 From: Serial Date: Mon, 19 Jul 2021 13:30:24 -0400 Subject: [PATCH] Don't error out on an empty tag --- src/components/tags/ape_tag.rs | 2 +- src/components/tags/id3_tag.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/tags/ape_tag.rs b/src/components/tags/ape_tag.rs index 54b76a18..b7568c8a 100644 --- a/src/components/tags/ape_tag.rs +++ b/src/components/tags/ape_tag.rs @@ -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, }) } diff --git a/src/components/tags/id3_tag.rs b/src/components/tags/id3_tag.rs index f9480edc..8f4a264d 100644 --- a/src/components/tags/id3_tag.rs +++ b/src/components/tags/id3_tag.rs @@ -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), }), }