mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-28 16:50:09 +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)
|
createConnection(decodePipeline)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val connectResult = async {
|
@Suppress("JoinDeclarationAndAssignment")
|
||||||
connection.join()
|
private val connectResult: Deferred<Unit>
|
||||||
context[SsoProcessor].login(this@NettyNetworkHandler)
|
|
||||||
}.apply {
|
init {
|
||||||
invokeOnCompletion { error ->
|
connectResult = async {
|
||||||
|
connection.join()
|
||||||
|
context[SsoProcessor].login(this@NettyNetworkHandler)
|
||||||
|
}
|
||||||
|
connectResult.invokeOnCompletion { error ->
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
this@NettyNetworkHandler.launch { resumeConnection() }
|
this@NettyNetworkHandler.launch { resumeConnection() }
|
||||||
} else {
|
} else {
|
||||||
@ -238,6 +242,7 @@ internal open class NettyNetworkHandler(
|
|||||||
}
|
}
|
||||||
// and this error will also be thrown by `StateConnecting.resumeConnection`
|
// and this error will also be thrown by `StateConnecting.resumeConnection`
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getCause(): Throwable? = collectiveExceptions.getLast()
|
override fun getCause(): Throwable? = collectiveExceptions.getLast()
|
||||||
|
Loading…
Reference in New Issue
Block a user