Twelve: Don't set thumbnail if it has an invalid URI
diff --git a/app/src/main/java/org/lineageos/twelve/datasources/SubsonicDataSource.kt b/app/src/main/java/org/lineageos/twelve/datasources/SubsonicDataSource.kt
index 34dae50..50f62b0 100644
--- a/app/src/main/java/org/lineageos/twelve/datasources/SubsonicDataSource.kt
+++ b/app/src/main/java/org/lineageos/twelve/datasources/SubsonicDataSource.kt
@@ -210,19 +210,23 @@
artistUri = artistId?.let { getArtistUri(it) } ?: Uri.EMPTY,
artistName = artist ?: "",
year = year,
- thumbnail = Thumbnail(
- uri = Uri.parse(subsonicClient.getCoverArt(id)),
- type = Thumbnail.Type.FRONT_COVER,
- ),
+ thumbnail = runCatching {
+ Thumbnail(
+ uri = Uri.parse(subsonicClient.getCoverArt(id)),
+ type = Thumbnail.Type.FRONT_COVER,
+ )
+ }.getOrNull(),
)
private fun ArtistID3.toMediaItem() = Artist(
uri = getArtistUri(id),
name = name,
- thumbnail = Thumbnail(
- uri = Uri.parse(subsonicClient.getCoverArt(id)),
- type = Thumbnail.Type.BAND_ARTIST_LOGO,
- ),
+ thumbnail = runCatching {
+ Thumbnail(
+ uri = Uri.parse(subsonicClient.getCoverArt(id)),
+ type = Thumbnail.Type.BAND_ARTIST_LOGO,
+ )
+ }.getOrNull(),
)
private fun Child.toMediaItem() = Audio(