mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-22 13:46:13 +08:00
Fix NPE in StateConnecting
This commit is contained in:
parent
b53e546743
commit
361304b9f2
@ -217,11 +217,15 @@ internal open class NettyNetworkHandler(
|
||||
createConnection(decodePipeline)
|
||||
}
|
||||
|
||||
private val connectResult = async {
|
||||
connection.join()
|
||||
context[SsoProcessor].login(this@NettyNetworkHandler)
|
||||
}.apply {
|
||||
invokeOnCompletion { error ->
|
||||
@Suppress("JoinDeclarationAndAssignment")
|
||||
private val connectResult: Deferred<Unit>
|
||||
|
||||
init {
|
||||
connectResult = async {
|
||||
connection.join()
|
||||
context[SsoProcessor].login(this@NettyNetworkHandler)
|
||||
}
|
||||
connectResult.invokeOnCompletion { error ->
|
||||
if (error == null) {
|
||||
this@NettyNetworkHandler.launch { resumeConnection() }
|
||||
} else {
|
||||
@ -238,6 +242,7 @@ internal open class NettyNetworkHandler(
|
||||
}
|
||||
// and this error will also be thrown by `StateConnecting.resumeConnection`
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getCause(): Throwable? = collectiveExceptions.getLast()
|
||||
|
Loading…
Reference in New Issue
Block a user