More soft Fraction.fromByteArray

This commit is contained in:
DBotThePony 2021-12-29 08:52:53 +07:00
parent 1ea2361777
commit a8811ae072
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -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