Fix closing stream for preview

This commit is contained in:
J-Jamet committed 2021-02-08 18:25:29 +01:00
1 parent 9d182b8299
commit e911eea69c
1 file changed
+5 -2
@@ -77,8 +77,11 @@ data class Attachment(var name: String,
val asyncResult: Deferred<Bitmap?> = 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()
}