mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-23 22:00:10 +08:00
Fix uninitialized property exception when Bot.closed called before Bot.login
This commit is contained in:
parent
9597a70f58
commit
012d9d6e71
@ -329,14 +329,16 @@ internal abstract class AbstractBot<N : BotNetworkHandler> constructor(
|
||||
return
|
||||
}
|
||||
|
||||
if (this.network.areYouOk()) {
|
||||
GlobalScope.launch {
|
||||
runCatching { BotOfflineEvent.Active(this@AbstractBot, cause).broadcast() }.exceptionOrNull()
|
||||
?.let { logger.error(it) }
|
||||
if (::_network.isInitialized) {
|
||||
if (this.network.areYouOk()) {
|
||||
GlobalScope.launch {
|
||||
runCatching { BotOfflineEvent.Active(this@AbstractBot, cause).broadcast() }.exceptionOrNull()
|
||||
?.let { logger.error(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.network.close(cause)
|
||||
this.network.close(cause)
|
||||
}
|
||||
|
||||
if (supervisorJob.isActive) {
|
||||
if (cause == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user