diff --git a/src/ui/window.rs b/src/ui/window.rs index 7011290..00a13af 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -150,12 +150,6 @@ mod imp { Event::StartFile(_) => { window.notify("song"); // TODO: load cover art - - // sanity check - assert_eq!( - window.song().unwrap().stream_url(), - window.imp().mpv.get_property::("path").unwrap() - ); } Event::Hook(event) => match event.reply_userdata { @@ -332,14 +326,20 @@ mod imp { if self.obj().playlist_pos() < 0 { None } else { - Some( - self.obj() - .playlist_model() - .item(self.obj().playlist_pos() as u32) - .unwrap() - .dynamic_cast() - .unwrap(), - ) + let song: PlaybinSong = self + .obj() + .playlist_model() + .item(self.obj().playlist_pos() as u32) + .unwrap() + .dynamic_cast() + .unwrap(); + + // sanity check + assert_eq!( + song.stream_url(), + self.mpv.get_property::("path").unwrap() + ); + Some(song) } } }