From 2c7cb5e05434c46fca57f638c7ce491b0bbd9f68 Mon Sep 17 00:00:00 2001 From: Graham Date: Mon, 8 Feb 2021 18:40:14 +0000 Subject: [PATCH] Minimise code in the NotImplementedError catch block I think this is slightly more readable. Signed-off-by: Graham --- protocol/src/main/kotlin/org/openrs2/protocol/Rs2Decoder.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/Rs2Decoder.kt b/protocol/src/main/kotlin/org/openrs2/protocol/Rs2Decoder.kt index bef9ce51..e20a1353 100644 --- a/protocol/src/main/kotlin/org/openrs2/protocol/Rs2Decoder.kt +++ b/protocol/src/main/kotlin/org/openrs2/protocol/Rs2Decoder.kt @@ -63,8 +63,9 @@ public class Rs2Decoder(public var protocol: Protocol) : ByteToMessageDecoder() return } + val payload = input.readSlice(length) out += try { - decoder.decode(input.readSlice(length)) + decoder.decode(payload) } catch (ex: NotImplementedError) { // TODO(gpe): remove this catch block when every packet is implemented logger.warn { "Skipping unimplemented packet: ${decoder.javaClass}" }