diff options
author | Linnea Gräf <nea@nea.moe> | 2024-07-24 15:34:10 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-07-24 15:34:10 +0200 |
commit | a19d2e1e1b233dbd0bde9b74516cc4a399772066 (patch) | |
tree | 3e3f7741114c1a0c2465d420f1c377d744f7cd00 /src/main/kotlin/moe | |
parent | 0ea10aac312ce446a958ca654811a64ed82f09ac (diff) | |
download | Firmament-a19d2e1e1b233dbd0bde9b74516cc4a399772066.tar.gz Firmament-a19d2e1e1b233dbd0bde9b74516cc4a399772066.tar.bz2 Firmament-a19d2e1e1b233dbd0bde9b74516cc4a399772066.zip |
Fix exception during packet handling
Diffstat (limited to 'src/main/kotlin/moe')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/apis/ingame/InGameCodecWrapper.kt | 5 |
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) } |