Merge pull request #30 from MustafaSalih1993/dev

fixed mpd crash caused by unwraping
This commit is contained in:
Mustafa Salih 2021-01-12 06:54:17 +03:00 committed by GitHub
commit 79632b2acc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

2
Cargo.lock generated
View File

@ -397,7 +397,7 @@ checksum = "4e1b7878800220a76a08f32c057829511440f65528b63b940f2f2bc145d7ac68"
[[package]] [[package]]
name = "rsblocks" name = "rsblocks"
version = "0.1.6" version = "0.1.8"
dependencies = [ dependencies = [
"alsa", "alsa",
"breadx", "breadx",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "rsblocks" name = "rsblocks"
version = "0.1.6" version = "0.1.8"
authors = ["mustafa salih <mustafasalih1991@gmail.com>"] authors = ["mustafa salih <mustafasalih1991@gmail.com>"]
edition = "2018" edition = "2018"
readme = "README.md" readme = "README.md"

View File

@ -770,7 +770,13 @@ pub fn get_mpd_current(config: &Config) -> String {
Ok(connection) => connection, Ok(connection) => connection,
_ => return String::from(""), _ => 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!( let result = format!(
" {} {} {}", " {} {} {}",