Fixed a crash while removing songs from the queue

This commit is contained in:
Prathamesh More 2022-02-14 23:56:23 +05:30
parent 74d9d1db39
commit 5731b777f0

View file

@ -975,12 +975,16 @@ class MusicService : MediaBrowserServiceCompat(),
private fun removeSongImpl(song: Song) { private fun removeSongImpl(song: Song) {
val deletePosition = playingQueue.indexOf(song) val deletePosition = playingQueue.indexOf(song)
playingQueue.removeAt(deletePosition) if (deletePosition != -1) {
rePosition(deletePosition) playingQueue.removeAt(deletePosition)
rePosition(deletePosition)
}
val originalDeletePosition = originalPlayingQueue.indexOf(song) val originalDeletePosition = originalPlayingQueue.indexOf(song)
playingQueue.removeAt(originalDeletePosition) if (originalDeletePosition != -1) {
rePosition(originalDeletePosition) playingQueue.removeAt(originalDeletePosition)
rePosition(originalDeletePosition)
}
} }
fun removeSong(song: Song) { fun removeSong(song: Song) {