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:
@@ -68,7 +68,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) {
|
||||||
|
|||||||
@@ -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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user