From 8883803260e6cf5cf6922925c2c71e07bb79aba5 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 2 Jun 2014 22:12:13 -0400 Subject: [PATCH] Nullcheck the dispatchers on players. Should stop some crashes when spamming connectivity. --- .../cpw/mods/fml/common/network/FMLOutboundHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fml/src/main/java/cpw/mods/fml/common/network/FMLOutboundHandler.java b/fml/src/main/java/cpw/mods/fml/common/network/FMLOutboundHandler.java index 21f01ed89..9e97ede6b 100644 --- a/fml/src/main/java/cpw/mods/fml/common/network/FMLOutboundHandler.java +++ b/fml/src/main/java/cpw/mods/fml/common/network/FMLOutboundHandler.java @@ -106,8 +106,8 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { public List selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet) { EntityPlayerMP player = (EntityPlayerMP) args; - NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get(); - return ImmutableList.of(dispatcher); + NetworkDispatcher dispatcher = player == null ? null : player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get(); + return dispatcher == null ? ImmutableList.of() : ImmutableList.of(dispatcher); } }, /** @@ -223,7 +223,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { public List selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet) { NetworkManager clientConnection = FMLCommonHandler.instance().getClientToServerNetworkManager(); - return clientConnection == null ? ImmutableList.of() : ImmutableList.of(clientConnection.channel().attr(NetworkDispatcher.FML_DISPATCHER).get()); + return clientConnection == null || clientConnection.channel().attr(NetworkDispatcher.FML_DISPATCHER).get() == null ? ImmutableList.of() : ImmutableList.of(clientConnection.channel().attr(NetworkDispatcher.FML_DISPATCHER).get()); } };