Fixed wrong usage of ProtocolVersion#getProtocol

This commit is contained in:
FlorianMichael 2024-02-25 18:34:49 +01:00
parent 972a6932b2
commit 4090a6eb12
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
1 changed files with 4 additions and 6 deletions

View File

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