This commit is contained in:
Erica Z 2024-11-13 16:36:03 +01:00
parent f0f69b7323
commit d37ec6a19a

View file

@ -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::<f64>("duration").unwrap()