Twelve: Don't fail if we can't decode the bitmap
Sometimes the data is filled but we can't decode
the content
diff --git a/app/src/main/java/org/lineageos/twelve/viewmodels/NowPlayingViewModel.kt b/app/src/main/java/org/lineageos/twelve/viewmodels/NowPlayingViewModel.kt
index ebdc154..74927aa 100644
--- a/app/src/main/java/org/lineageos/twelve/viewmodels/NowPlayingViewModel.kt
+++ b/app/src/main/java/org/lineageos/twelve/viewmodels/NowPlayingViewModel.kt
@@ -161,7 +161,9 @@
mediaMetadata.artworkUri?.let {
Thumbnail(uri = it)
} ?: mediaMetadata.artworkData?.let {
- Thumbnail(bitmap = BitmapFactory.decodeByteArray(it, 0, it.size))
+ BitmapFactory.decodeByteArray(it, 0, it.size)?.let { bitmap ->
+ Thumbnail(bitmap = bitmap)
+ }
}
)
}