diff --git a/src/mpris_client.rs b/src/mpris_client.rs index 0f122af..08d090b 100644 --- a/src/mpris_client.rs +++ b/src/mpris_client.rs @@ -1,3 +1,4 @@ +use log::warn; use mpris::Player; use mpris::PlayerFinder; use regex::Regex; @@ -36,10 +37,15 @@ where { let player = PlayerFinder::new() .expect("Could not connect to D-Bus") - .find_active() - .expect("Could not find any player"); - - function(&player); + .find_active(); + match player { + Ok(p) => { + function(&p); + } + Err(err) => { + warn!("Could not find an active player: {err}"); + } + } } fn exec_functionality(player_id: Option<&str>, exec_closure: F)