From 5dbef99949ec645d48953ae39656bc860206c226 Mon Sep 17 00:00:00 2001 From: Hardcore Sushi Date: Wed, 1 Feb 2023 20:06:35 +0100 Subject: [PATCH] Fix EncryptedVolumeDataSource EOF --- .../droidfs/file_viewers/EncryptedVolumeDataSource.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/EncryptedVolumeDataSource.kt b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/EncryptedVolumeDataSource.kt index 859694a..f4e59ca 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/file_viewers/EncryptedVolumeDataSource.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/file_viewers/EncryptedVolumeDataSource.kt @@ -50,7 +50,11 @@ class EncryptedVolumeDataSource(private val encryptedVolume: EncryptedVolume, pr ) {} val totalRead = fileOffset-originalOffset bytesRemaining -= totalRead - return totalRead.toInt() + return if (totalRead == 0L) { + C.RESULT_END_OF_INPUT + } else { + totalRead.toInt() + } } class Factory(private val encryptedVolume: EncryptedVolume, private val filePath: String): DataSource.Factory {