diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/Attachment.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/Attachment.kt index 5bcb51956..9c200d372 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/Attachment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/Attachment.kt @@ -77,8 +77,11 @@ data class Attachment(var name: String, val asyncResult: Deferred = async { runCatching { binaryCipherKey?.let { binaryKey -> - BitmapFactory.decodeStream(attachment.binaryAttachment - .getUnGzipInputDataStream(binaryKey)) + var bitmap: Bitmap? + attachment.binaryAttachment.getUnGzipInputDataStream(binaryKey).use { bitmapInputStream -> + bitmap = BitmapFactory.decodeStream(bitmapInputStream) + } + bitmap } }.getOrNull() }