From 9dcb35a91e0179429751f65a5465dd48de059501 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 13 Apr 2022 20:35:47 +0200 Subject: [PATCH 1/2] Fix pipeline null errors Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/listeners/mods/Forge.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Forge.java b/src/de/steamwar/bungeecore/listeners/mods/Forge.java index c936dd0..6136fd5 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Forge.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Forge.java @@ -22,6 +22,7 @@ package de.steamwar.bungeecore.listeners.mods; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.sql.Mod; +import io.netty.channel.ChannelPipeline; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.event.LoginEvent; @@ -78,7 +79,9 @@ public class Forge extends BasicListener { } event.registerIntent(BungeeCore.get()); - wrapper.getHandle().pipeline().get(HandlerBoss.class).setHandler(new CustomPacketHandler(event)); + ChannelPipeline pipeline = wrapper.getHandle().pipeline(); + if(pipeline != null) + pipeline.get(HandlerBoss.class).setHandler(new CustomPacketHandler(event)); } private static class CustomPacketHandler extends PacketHandler { From 336d4f6a3cec6f45b3ccc309132cf46f04b54f89 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 13 Apr 2022 20:55:51 +0200 Subject: [PATCH 2/2] Fix NPE Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/listeners/mods/Forge.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Forge.java b/src/de/steamwar/bungeecore/listeners/mods/Forge.java index 6136fd5..0539713 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Forge.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Forge.java @@ -80,8 +80,11 @@ public class Forge extends BasicListener { event.registerIntent(BungeeCore.get()); ChannelPipeline pipeline = wrapper.getHandle().pipeline(); - if(pipeline != null) - pipeline.get(HandlerBoss.class).setHandler(new CustomPacketHandler(event)); + if(pipeline != null) { + HandlerBoss handlerBoss = pipeline.get(HandlerBoss.class); + if(handlerBoss != null) + handlerBoss.setHandler(new CustomPacketHandler(event)); + } } private static class CustomPacketHandler extends PacketHandler {