Skip to content

Commit

Permalink
Do not expect to always receive an instance of Channel in injector (#118
Browse files Browse the repository at this point in the history
)

Mods like Raknetify break this assumption, so to avoid class cast exceptions we use an instanceof cast.

Fixes #100
  • Loading branch information
pompompopi authored Apr 27, 2024
1 parent 160cc5e commit 046311d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public void injectClient(ChannelFuture future) {
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
super.channelRead(ctx, msg);

Channel channel = (Channel) msg;
if (!(msg instanceof Channel channel)) {
return;
}

channel.pipeline().addLast(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) {
Expand Down

0 comments on commit 046311d

Please sign in to comment.