[core] [Network] Handle non ipaddress converting caused by some unknown

This commit is contained in:
Karlatemp 2022-10-20 12:58:09 +08:00
parent 58ab562322
commit ddfd22e541
No known key found for this signature in database
GPG Key ID: BA173CA2B9956C59

View File

@ -168,8 +168,16 @@ internal class StatSvc {
) = impl("online", client, 1L or 2 or 4, client.onlineStatus, regPushReason) {
if (client.bot.configuration.protocol == BotConfiguration.MiraiProtocol.ANDROID_PHONE) {
client.bot.components[ServerList].run {
uOldSSOIp = lastDisconnectedIP.toIpV4Long()
uNewSSOIp = lastConnectedIP.toIpV4Long()
kotlin.runCatching {
uOldSSOIp = lastDisconnectedIP.toIpV4Long()
uNewSSOIp = lastConnectedIP.toIpV4Long()
}.onFailure { err ->
client.bot.network.logger.warning({
"Exception when converting ipaddress to long: ld=${lastDisconnectedIP}, lc=${lastConnectedIP}"
}, err)
uNewSSOIp = 0
uOldSSOIp = 0
}
}
} else {
uOldSSOIp = 0