diff --git a/Cargo.lock b/Cargo.lock index a168dae..ff50eb5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -397,7 +397,7 @@ checksum = "4e1b7878800220a76a08f32c057829511440f65528b63b940f2f2bc145d7ac68" [[package]] name = "rsblocks" -version = "0.1.6" +version = "0.1.8" dependencies = [ "alsa", "breadx", diff --git a/Cargo.toml b/Cargo.toml index 1c7f856..d80267d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsblocks" -version = "0.1.6" +version = "0.1.8" authors = ["mustafa salih "] edition = "2018" readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index 6a29067..d417164 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -770,7 +770,13 @@ pub fn get_mpd_current(config: &Config) -> String { Ok(connection) => connection, _ => return String::from(""), }; - let current: Song = conn.currentsong().unwrap().unwrap(); + let current: Song = match conn.currentsong() { + Ok(opt) => match opt { + Some(song) => song, + _ => return String::from(""), + }, + _ => return String::from(""), + }; let result = format!( " {} {} {}",