diff --git a/mirai-core/src/commonMain/kotlin/network/handler/NetworkHandlerSupport.kt b/mirai-core/src/commonMain/kotlin/network/handler/NetworkHandlerSupport.kt index 3e4d9e913..7afe0f993 100644 --- a/mirai-core/src/commonMain/kotlin/network/handler/NetworkHandlerSupport.kt +++ b/mirai-core/src/commonMain/kotlin/network/handler/NetworkHandlerSupport.kt @@ -88,6 +88,7 @@ internal abstract class NetworkHandlerSupport( } final override suspend fun sendAndExpect(packet: OutgoingPacket, timeout: Long, attempts: Int): Packet? { + require(attempts >= 1) { "attempts must be at least 1." } val listener = PacketListener(packet.commandName, packet.sequenceId) withExceptionCollector { repeat(attempts) {