playback: fix crash w/add to queue
Again, a two-fold problem: - Was not properly giving the right StateAck to the state holder - ShuffleOrder not properly handling the index given when adding to queue internally Resolves #727.
This commit is contained in:
parent
44b7a435d1
commit
691ed202e5
2 changed files with 6 additions and 2 deletions
|
@ -492,7 +492,7 @@ class PlaybackStateManagerImpl @Inject constructor() : PlaybackStateManager {
|
||||||
} else {
|
} else {
|
||||||
val stateHolder = stateHolder ?: return
|
val stateHolder = stateHolder ?: return
|
||||||
logD("Adding ${songs.size} songs to end of queue")
|
logD("Adding ${songs.size} songs to end of queue")
|
||||||
stateHolder.addToQueue(songs, StateAck.AddToQueue(stateMirror.index + 1, songs.size))
|
stateHolder.addToQueue(songs, StateAck.AddToQueue(queue.size, songs.size))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,11 @@ class BetterShuffleOrder(private val shuffled: IntArray) : ShuffleOrder {
|
||||||
}
|
}
|
||||||
|
|
||||||
val newShuffled = IntArray(shuffled.size + insertionCount)
|
val newShuffled = IntArray(shuffled.size + insertionCount)
|
||||||
val pivot = indexInShuffled[insertionIndex]
|
val pivot: Int = if (insertionIndex < shuffled.size) {
|
||||||
|
indexInShuffled[insertionIndex]
|
||||||
|
} else {
|
||||||
|
indexInShuffled.size
|
||||||
|
}
|
||||||
for (i in shuffled.indices) {
|
for (i in shuffled.indices) {
|
||||||
var currentIndex = shuffled[i]
|
var currentIndex = shuffled[i]
|
||||||
if (currentIndex > insertionIndex) {
|
if (currentIndex > insertionIndex) {
|
||||||
|
|
Loading…
Reference in a new issue