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? {
|
private fun getFallbackAlbumImage(): InputStream? {
|
||||||
|
model.artist.safeGetFirstAlbum().id.let { id->
|
||||||
|
return if (id != -1L) {
|
||||||
val imageUri = MusicUtil.getMediaStoreAlbumCoverUri(model.artist.safeGetFirstAlbum().id)
|
val imageUri = MusicUtil.getMediaStoreAlbumCoverUri(model.artist.safeGetFirstAlbum().id)
|
||||||
return try {
|
try {
|
||||||
context.contentResolver.openInputStream(imageUri)
|
context.contentResolver.openInputStream(imageUri)
|
||||||
} catch (e: FileNotFoundException){
|
} catch (e: FileNotFoundException){
|
||||||
null
|
null
|
||||||
|
} catch (e: UnsupportedOperationException) {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue