Fix: Crash in BookInfo. (When deleting cover image)

This commit is contained in:
acclorite 2024-08-07 19:24:05 +03:00
parent 75587b46aa
commit 69a72c59fc

View file

@ -401,10 +401,15 @@ class BookRepositoryImpl @Inject constructor(
val byteArray = stream.toByteArray() val byteArray = stream.toByteArray()
val defaultCover = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.size) val defaultCover = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.size)
val currentCover = MediaStore.Images.Media.getBitmap( val currentCover = try {
application.contentResolver, MediaStore.Images.Media.getBitmap(
Uri.parse(book.image) application.contentResolver,
) Uri.parse(book.image)
)
} catch (e: Exception) {
e.printStackTrace()
return true
}
return !defaultCover.sameAs(currentCover) return !defaultCover.sameAs(currentCover)
} }