diff --git a/mirai-core/src/commonMain/kotlin/network/handler/selector/SelectorNetworkHandler.kt b/mirai-core/src/commonMain/kotlin/network/handler/selector/SelectorNetworkHandler.kt index 3a0bda149..39f4ad7f1 100644 --- a/mirai-core/src/commonMain/kotlin/network/handler/selector/SelectorNetworkHandler.kt +++ b/mirai-core/src/commonMain/kotlin/network/handler/selector/SelectorNetworkHandler.kt @@ -61,7 +61,7 @@ internal class SelectorNetworkHandler( if (allowActiveMaintenance) { val bot = context.bot scope.launch(scope.hierarchicalName("BotOnlineWatchdog ${bot.id}")) { - while (isActive) { + while (isActive && bot.isActive) { val instance = selector.getCurrentInstanceOrCreate() awaitState(State.CLOSED) // suspend until next CLOSED