Skip to content

Commit

Permalink
Fix QueueService.getNextIndices returning one item too many when usin…
Browse files Browse the repository at this point in the history
…g REPEAT_ENTRY_ONCE
  • Loading branch information
nielsvanvelzen committed Dec 21, 2024
1 parent eb7fd83 commit 8b2d398
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions playback/core/src/main/kotlin/queue/QueueService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ class QueueService internal constructor() : PlayerService(), Queue {
return when (repeatMode) {
RepeatMode.NONE -> provider.provideIndices(amount, estimatedSize, currentQueueIndicesPlayed, entryIndex.value)

RepeatMode.REPEAT_ENTRY_ONCE -> buildList {
RepeatMode.REPEAT_ENTRY_ONCE -> buildList(amount) {
add(entryIndex.value)
addAll(provider.provideIndices(amount, estimatedSize, currentQueueIndicesPlayed, entryIndex.value))
addAll(provider.provideIndices(amount - 1, estimatedSize, currentQueueIndicesPlayed, entryIndex.value))
}.take(amount)

RepeatMode.REPEAT_ENTRY_INFINITE -> List(amount) { entryIndex.value }
Expand Down

0 comments on commit 8b2d398

Please sign in to comment.