Skip to content

Commit

Permalink
config: properly handle missing initial_volume
Browse files Browse the repository at this point in the history
  • Loading branch information
eladyn committed Jan 19, 2025
1 parent fa41e08 commit 82f633d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ fn number_or_string<'de, D>(de: D) -> Result<Option<u8>, D::Error>
where
D: Deserializer<'de>,
{
let Some(val) = Option::<toml::Value>::deserialize(de)? else {
return Ok(None);
};
let val = toml::Value::deserialize(de)?;

let unexpected = match val {
toml::Value::Integer(num) => {
Expand Down Expand Up @@ -292,7 +290,7 @@ pub struct SharedConfigValues {

/// Initial volume between 0 and 100
#[arg(long)]
#[serde(deserialize_with = "number_or_string")]
#[serde(deserialize_with = "number_or_string", default)]
initial_volume: Option<u8>,

/// Enable to normalize the volume during playback
Expand Down

0 comments on commit 82f633d

Please sign in to comment.