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()