From 2fcb8d915d2c669002d91389618fbc72fafe996b Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sat, 16 Jun 2018 16:29:40 +0300 Subject: [PATCH] PlayerWidget: Remove an .expect() occurrence. --- hammond-gtk/src/widgets/player.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/hammond-gtk/src/widgets/player.rs b/hammond-gtk/src/widgets/player.rs index 980cf32..103ef39 100644 --- a/hammond-gtk/src/widgets/player.rs +++ b/hammond-gtk/src/widgets/player.rs @@ -286,20 +286,21 @@ impl PlayerWidget { // path is an absolute fs path ex. "foo/bar/baz". // Convert it so it will have a "file:///" // FIXME: convert it properly - let uri = File::new_for_path(path).get_uri().expect("Bad file path"); + if let Some(uri) = File::new_for_path(path).get_uri() { + // FIXME: Maybe should also reset/flush the pipeline and then add the file? - // FIXME: Maybe should also reset/flush the pipeline and then add the file? - - // play the file - self.player.set_uri(&uri); - self.play(); - return Ok(()); + // play the file + self.player.set_uri(&uri); + self.play(); + return Ok(()); + } } // TODO: log an error } - // Stream stuff - unimplemented!() + // FIXME: Stream stuff + // unimplemented!() + Ok(()) } fn connect_update_slider(slider: >k::Scale, player: &gst_player::Player) -> SignalHandlerId {