PlayerWidget: Remove an .expect() occurrence.

This commit is contained in:
Jordan Petridis 2018-06-16 16:29:40 +03:00
parent a596b62a5f
commit 2fcb8d915d

View File

@ -286,20 +286,21 @@ impl PlayerWidget {
// path is an absolute fs path ex. "foo/bar/baz". // path is an absolute fs path ex. "foo/bar/baz".
// Convert it so it will have a "file:///" // Convert it so it will have a "file:///"
// FIXME: convert it properly // 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);
// play the file self.play();
self.player.set_uri(&uri); return Ok(());
self.play(); }
return Ok(());
} }
// TODO: log an error // TODO: log an error
} }
// Stream stuff // FIXME: Stream stuff
unimplemented!() // unimplemented!()
Ok(())
} }
fn connect_update_slider(slider: &gtk::Scale, player: &gst_player::Player) -> SignalHandlerId { fn connect_update_slider(slider: &gtk::Scale, player: &gst_player::Player) -> SignalHandlerId {