Skip to content

Commit

Permalink
fix: app crash after deleting songs, try fix for #335
Browse files Browse the repository at this point in the history
  • Loading branch information
Malopieds committed Aug 24, 2024
1 parent cfe1e26 commit b489633
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.core.net.toUri
import androidx.media3.common.Player
import androidx.media3.common.Timeline
import androidx.media3.exoplayer.offline.Download
import androidx.media3.exoplayer.offline.DownloadRequest
Expand Down Expand Up @@ -540,8 +541,9 @@ fun SelectionMediaMetadataMenu(
onDismiss()
var i = 0
currentItems.forEach { cur ->
playerConnection.player.removeMediaItem(cur.firstPeriodIndex - i)
i++
if (playerConnection.player.availableCommands.contains(Player.COMMAND_CHANGE_MEDIA_ITEMS)) {
playerConnection.player.removeMediaItem(cur.firstPeriodIndex - i++)
}
}
clearAction()
}
Expand Down

0 comments on commit b489633

Please sign in to comment.