From ed376097317651a5eae73eb5f7c2d471d797029c Mon Sep 17 00:00:00 2001 From: Him188 Date: Mon, 2 May 2022 09:59:44 +0100 Subject: [PATCH] Fix TarsInput, fix #1998 --- .../utils/io/serialization/tars/internal/TarsInput.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt index 42195b6f7..f847a578c 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt @@ -78,7 +78,12 @@ internal class TarsInput( if (input.endOfInput) { return null } - val var2 = input.readUByte() + val var2 = try { + input.readUByte() + } catch (e: EOFException) { + // somehow `endOfInput` still returns false + return null + } val type = var2 and 15u var tag = var2.toUInt() shr 4 if (tag == 15u) {