Fix exoplayer crash (regression)

This commit is contained in:
vfsfitvnm 2022-09-15 19:01:44 +02:00
parent e13d083a8c
commit b35b3b2df2

View file

@ -182,10 +182,11 @@ fun Controls(
colorFilter = ColorFilter.tint(colorPalette.favoritesIcon),
modifier = Modifier
.clickable {
val currentMediaItem = binder.player.currentMediaItem
query {
if (Database.like(mediaId, if (likedAt == null) System.currentTimeMillis() else null) == 0) {
binder.player.currentMediaItem?.takeIf { it.mediaId == mediaId }?.let { mediaItem ->
Database.insert(mediaItem, Song::toggleLike)
currentMediaItem?.takeIf { it.mediaId == mediaId }?.let {
Database.insert(currentMediaItem, Song::toggleLike)
}
}
}