APE/ID3v1: Remove items in setters when given empty value

This commit is contained in:
Serial 2023-01-20 21:17:26 -05:00
parent 533cd7dcff
commit a201ab33f7
No known key found for this signature in database
GPG key ID: DA95198DC17C4568
2 changed files with 10 additions and 0 deletions

View file

@ -33,6 +33,11 @@ macro_rules! impl_accessor {
}
fn [<set_ $name>](&mut self, value: String) {
if value.is_empty() {
self.[<remove_ $name>]();
return;
}
self.insert(ApeItem {
read_only: false,
key: String::from(crate::tag::item::first_key!($($key)|*)),

View file

@ -24,6 +24,11 @@ macro_rules! impl_accessor {
}
fn [<set_ $name>](&mut self, value: String) {
if value.is_empty() {
self.[<remove_ $name>]();
return;
}
self.$name = Some(value)
}