Add missed channel check

This commit is contained in:
sandtechnology 2020-12-17 13:07:08 +08:00
parent ab6e8b33eb
commit e30f97dc2e

View File

@ -615,6 +615,7 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo
suspend fun OutgoingPacket.sendWithoutExpect() { suspend fun OutgoingPacket.sendWithoutExpect() {
check(bot.isActive) { "bot is dead therefore can't send ${this.commandName}" } check(bot.isActive) { "bot is dead therefore can't send ${this.commandName}" }
check(this@QQAndroidBotNetworkHandler.isActive) { "network is dead therefore can't send any packet" } check(this@QQAndroidBotNetworkHandler.isActive) { "network is dead therefore can't send any packet" }
check(channel.isOpen) { "network channel is closed" }
logger.verbose { "Send: ${this.commandName}" } logger.verbose { "Send: ${this.commandName}" }
channel.send(delegate) channel.send(delegate)
} }