From e6203e11b59a1b1371a6790f3fa878c1da337d0c Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 2 Jan 2024 15:05:22 +0700 Subject: [PATCH] Fallback to zero if there is excess data when deserializing infinities --- src/main/kotlin/ru/dbotthepony/mc/otm/core/math/Decimal.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/Decimal.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/Decimal.kt index 69e20e0c1..9011af8c0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/Decimal.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/Decimal.kt @@ -1498,8 +1498,8 @@ sealed class Decimal : Number(), Comparable { } else { return when (input[0]) { TYPE_NORMAL -> raw(BigInteger(input.copyOfRange(1, input.size))) - TYPE_NEGATIVE_INFINITY -> NegativeInfinity - TYPE_POSITIVE_INFINITY -> PositiveInfinity + TYPE_NEGATIVE_INFINITY -> if (input.size == 1) NegativeInfinity else Zero + TYPE_POSITIVE_INFINITY -> if (input.size == 1) PositiveInfinity else Zero // TYPE_ZERO -> Zero else -> Zero }