From 64f7b5be54ebec5379b13f88ccf131adf63784b0 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 12 Jan 2025 14:41:49 +0100 Subject: [PATCH] Fix FileAccessStream#readNextByte --- .../engine/base/implementation/stream/FileAccessStream.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt index d52f451..e46451c 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt @@ -102,7 +102,12 @@ class FileAccessStream internal constructor(val file: FileAccess) : Stream(strea .createFile() .verifyIsFile() - return inputStream.read().toByte() + val byte: Int = inputStream.read() + + return if (byte == -1) + null + else + byte.toByte() } catch (_: VerificationFailedException) { throw IOAccessException("File '${file}' does not exist") }