From 87037beb9bd8ba8c1f02d6865ad6da083569332e Mon Sep 17 00:00:00 2001 From: xRMG412 Date: Mon, 1 Nov 2021 18:45:06 -0500 Subject: [PATCH] Add check for zero in "next_index" --- src/app/state/playback_state.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/state/playback_state.rs b/src/app/state/playback_state.rs index 625737ca..b87fe834 100644 --- a/src/app/state/playback_state.rs +++ b/src/app/state/playback_state.rs @@ -176,8 +176,9 @@ impl PlaybackState { let len = self.songs.len(); self.position.and_then(|p| match self.repeat { RepeatMode::Song => Some(p), - RepeatMode::Playlist => Some((p + 1) % len), + RepeatMode::Playlist if len != 0 => Some((p + 1) % len), RepeatMode::None => Some(p + 1).filter(|&i| i < len), + _ => None, }) }