Skip to content

Commit 6f8b237

Browse files
committed
Fix last wrapped exception
Fixes #711
1 parent c893a3f commit 6f8b237

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,15 @@ private void encode(ChannelHandlerContext ctx, Object packet, ByteBuf output) th
469469
} finally {
470470
// Attempt to handle the packet nevertheless
471471
if (packet != null) {
472-
ENCODE_BUFFER.invoke(vanillaEncoder, ctx, packet, output);
472+
try {
473+
ENCODE_BUFFER.invoke(vanillaEncoder, ctx, packet, output);
474+
} catch (InvocationTargetException ex) {
475+
if (ex.getCause() instanceof Exception) {
476+
//noinspection ThrowFromFinallyBlock
477+
throw (Exception) ex.getCause();
478+
}
479+
}
480+
473481
finalEvent = event;
474482
}
475483
}

0 commit comments

Comments
 (0)