fix NPE when version isn't specified

This commit is contained in:
creeper123123321 2024-03-07 09:53:31 -03:00
parent 989f6b0d22
commit ed24df38a8

View File

@ -148,13 +148,13 @@ class WebLogin : WebState {
webClient.server.addressCallbacks[callback].complete(
AddressInfo(
backVersion = obj["version"].asString.let {
val output = Ints.tryParse(it)
val protocol = if (output == null) {
val number = Ints.tryParse(it)
val protocol = if (number == null) {
ProtocolVersion.getClosest(it)
} else {
ProtocolVersion.getProtocol(output)
}
if (!protocol!!.isKnown) AUTO else protocol
ProtocolVersion.getProtocol(number)
} ?: AUTO
if (!protocol.isKnown) AUTO else protocol
},
backHostAndPort = HostAndPort.fromParts(obj["host"].asString, obj["port"].asInt),
frontOnline = obj["frontOnline"].asString.toBooleanStrictOrNull(),