From d37ec6a19a186c297dfa7f8e22064c988543bb8e Mon Sep 17 00:00:00 2001 From: Erica Z Date: Wed, 13 Nov 2024 16:36:03 +0100 Subject: [PATCH] decrash --- src/ui/window.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ui/window.rs b/src/ui/window.rs index ac9bdf5..5d46ed9 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -361,7 +361,10 @@ mod imp { match self.state.get() { State::Idle => 0.0, - State::FileLoading | State::FileEnded => self.song().unwrap().duration() as f64, + State::FileLoading | State::FileEnded => self + .song() + .map(|song| song.duration() as f64) + .unwrap_or(0.0), State::FileLoaded | State::Active | State::Seeking => { self.mpv.get_property::("duration").unwrap()