Skip to content

Commit

Permalink
Fix exception during packet handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nea89o committed Jul 24, 2024
1 parent 0ea10aa commit a19d2e1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit a19d2e1

Please sign in to comment.