Fixed a crash when a Song is deleted in Artist Details
This commit is contained in:
parent
cf217b5733
commit
dff682c1f1
1 changed files with 13 additions and 5 deletions
|
@ -90,11 +90,19 @@ class ArtistImageFetcher(
|
|||
}
|
||||
|
||||
private fun getFallbackAlbumImage(): InputStream? {
|
||||
val imageUri = MusicUtil.getMediaStoreAlbumCoverUri(model.artist.safeGetFirstAlbum().id)
|
||||
return try {
|
||||
context.contentResolver.openInputStream(imageUri)
|
||||
} catch (e: FileNotFoundException){
|
||||
null
|
||||
model.artist.safeGetFirstAlbum().id.let { id->
|
||||
return if (id != -1L) {
|
||||
val imageUri = MusicUtil.getMediaStoreAlbumCoverUri(model.artist.safeGetFirstAlbum().id)
|
||||
try {
|
||||
context.contentResolver.openInputStream(imageUri)
|
||||
} catch (e: FileNotFoundException){
|
||||
null
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
null
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue