From a8811ae0723847cb3aadb728379c2c9286015d52 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 29 Dec 2021 08:52:53 +0700 Subject: [PATCH] More soft Fraction.fromByteArray --- src/main/kotlin/ru/dbotthepony/mc/otm/core/Fraction.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Fraction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Fraction.kt index 598cec5c2..3fd36cdb9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Fraction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Fraction.kt @@ -639,7 +639,7 @@ data class Fraction @JvmOverloads constructor(@JvmField val value: BigInteger, @ val offsetB = 1 + bytes[0].toInt() val bytesB = bytes.copyOfRange(offsetB + 1, offsetB + 1 + bytes[offsetB].toInt()) - return Fraction(BigInteger(bytesA), BigInteger(bytesB)) + return Fraction(if (bytesA.isNotEmpty()) BigInteger(bytesA) else BigInteger.ZERO, if (bytesB.isNotEmpty()) BigInteger(bytesB) else BigInteger.ZERO) } @JvmStatic