Change length binary method

This commit is contained in:
J-Jamet
2020-09-23 16:46:31 +02:00
parent ea126b90e2
commit 62cca09045

View File

@@ -36,9 +36,7 @@ class BinaryAttachment : Parcelable {
private var dataFile: File? = null private var dataFile: File? = null
fun length(): Long { fun length(): Long {
if (dataFile != null) return dataFile?.length() ?: 0
return dataFile!!.length()
return 0
} }
/** /**
@@ -65,7 +63,7 @@ class BinaryAttachment : Parcelable {
@Throws(IOException::class) @Throws(IOException::class)
fun getInputDataStream(): InputStream { fun getInputDataStream(): InputStream {
return when { return when {
dataFile != null -> FileInputStream(dataFile!!) length() > 0 -> FileInputStream(dataFile!!)
else -> ByteArrayInputStream(ByteArray(0)) else -> ByteArrayInputStream(ByteArray(0))
} }
} }