From daff4e7dbd89113a89bd2e125500772d84d8e262 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Mon, 4 Nov 2024 13:54:30 +0100 Subject: [PATCH] move sanity check --- src/ui/window.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) 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) } } }