mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-31 03:22:36 +08:00
[core] Fix network initialize order; Ensure bot components when network handler allocated; fix #2740
This commit is contained in:
parent
eab15f9125
commit
61e8501c66
@ -135,8 +135,10 @@ internal abstract class AbstractBot(
|
||||
@Volatile
|
||||
var networkInitialized = false
|
||||
val network: NetworkHandler by lazy {
|
||||
networkInitialized = true
|
||||
createNetworkHandler()
|
||||
createNetworkHandler().also {
|
||||
it.context // ensure components available
|
||||
networkInitialized = true
|
||||
}
|
||||
} // the selector handles renewal of [NetworkHandler]
|
||||
|
||||
final override suspend fun login() {
|
||||
|
Loading…
Reference in New Issue
Block a user