mirror of
https://github.com/packwiz/packwiz-installer.git
synced 2025-04-18 20:46:30 +02:00
Fix handling of old packwiz.json files with negative murmur2 values
This commit is contained in:
parent
d98baaf832
commit
a8f8444d45
@ -21,7 +21,14 @@ data class Hash<T>(val type: HashFormat<T>, val value: T) {
|
||||
|
||||
object UInt: Encoding<kotlin.UInt> {
|
||||
override fun encodeToString(value: kotlin.UInt) = value.toString()
|
||||
override fun decodeFromString(str: String) = str.toUInt()
|
||||
override fun decodeFromString(str: String) =
|
||||
try {
|
||||
str.toUInt()
|
||||
} catch (e: NumberFormatException) {
|
||||
// Old packwiz.json values are signed; if they are negative they should be parsed as signed integers
|
||||
// and reinterpreted as unsigned integers
|
||||
str.toInt().toUInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user