Skip to content

Commit

Permalink
fix(crash): Avoid remove crashing on Android < 8 (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcvz authored Nov 8, 2023
1 parent a170298 commit f84fe5e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ class QueuedAudioPlayer(
* @param indexes The indexes of the items to remove.
*/
fun remove(indexes: List<Int>) {
val sorted = indexes.toList()
val sorted = indexes.toMutableList()
// Sort the indexes in descending order so we can safely remove them one by one
// without having the next index possibly newly pointing to another item than intended:
Collections.sort(sorted, Collections.reverseOrder());
sorted.sortDescending()
sorted.forEach {
remove(it)
}
Expand Down

0 comments on commit f84fe5e

Please sign in to comment.