aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/moe')
-rw-r--r--src/main/kotlin/moe/nea/firmament/apis/ingame/InGameCodecWrapper.kt5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/apis/ingame/InGameCodecWrapper.kt b/src/main/kotlin/moe/nea/firmament/apis/ingame/InGameCodecWrapper.kt
index 447b902..30bbc90 100644
--- a/src/main/kotlin/moe/nea/firmament/apis/ingame/InGameCodecWrapper.kt
+++ b/src/main/kotlin/moe/nea/firmament/apis/ingame/InGameCodecWrapper.kt
@@ -36,8 +36,9 @@ class InGameCodecWrapper(
val duplicateBuffer = PacketByteBuf(buf.slice())
val original = wrapped.decode(buf)
buf.skipBytes(buf.readableBytes())
- val duplicate = direction.customCodec.decode(duplicateBuffer)
- if (duplicate is FirmamentCustomPayload.Unhandled)
+ val duplicate = runCatching { direction.customCodec.decode(duplicateBuffer) }
+ .getOrNull()
+ if (duplicate is FirmamentCustomPayload.Unhandled || duplicate == null)
return original
return JoinedCustomPayload(original, duplicate)
}