Merge branch 'fixCrashes' into 'develop'

Fix a crash

See merge request ultrasonic/ultrasonic!874
This commit is contained in:
birdbird 2022-11-14 08:51:33 +00:00
commit 9c4d83d5f3

View File

@ -384,7 +384,7 @@ class JukeboxMediaPlayer : JukeboxUnimplementedFunctions(), Player {
if (currentIndex < 0 || currentIndex >= playlist.size) return
if (newIndex < 0 || newIndex >= playlist.size) return
val insertIndex = if (newIndex < currentIndex) newIndex else newIndex - 1
val insertIndex = if (newIndex < currentIndex) newIndex else (newIndex - 1).coerceAtLeast(0)
val item = playlist.removeAt(currentIndex)
playlist.add(insertIndex, item)
updatePlaylist()