Fixed a crash when a Song is deleted in Artist Details

This commit is contained in:
Prathamesh More 2021-12-28 13:11:56 +05:30
parent cf217b5733
commit dff682c1f1

View file

@ -90,11 +90,19 @@ class ArtistImageFetcher(
} }
private fun getFallbackAlbumImage(): InputStream? { private fun getFallbackAlbumImage(): InputStream? {
val imageUri = MusicUtil.getMediaStoreAlbumCoverUri(model.artist.safeGetFirstAlbum().id) model.artist.safeGetFirstAlbum().id.let { id->
return try { return if (id != -1L) {
context.contentResolver.openInputStream(imageUri) val imageUri = MusicUtil.getMediaStoreAlbumCoverUri(model.artist.safeGetFirstAlbum().id)
} catch (e: FileNotFoundException){ try {
null context.contentResolver.openInputStream(imageUri)
} catch (e: FileNotFoundException){
null
} catch (e: UnsupportedOperationException) {
null
}
} else {
null
}
} }
} }