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? {
model.artist.safeGetFirstAlbum().id.let { id->
return if (id != -1L) {
val imageUri = MusicUtil.getMediaStoreAlbumCoverUri(model.artist.safeGetFirstAlbum().id)
return try {
try {
context.contentResolver.openInputStream(imageUri)
} catch (e: FileNotFoundException){
null
} catch (e: UnsupportedOperationException) {
null
}
} else {
null
}
}
}