Skip to content

Commit

Permalink
Add check for zero in "next_index" (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmg-x authored Nov 3, 2021
1 parent 7e99268 commit c860a53
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/state/playback_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}

Expand Down

0 comments on commit c860a53

Please sign in to comment.