Add check for arguments of NetworkHandlerSupport.sendAndExpect

This commit is contained in:
Him188 2021-06-07 17:47:40 +08:00
parent 9ceb7c3fc2
commit 84fb928764

View File

@ -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) {