mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-13 22:22:31 +00:00
APE/ID3v1: Remove items in setters when given empty value
This commit is contained in:
parent
533cd7dcff
commit
a201ab33f7
2 changed files with 10 additions and 0 deletions
|
@ -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)|*)),
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue