forked from xjboss/KCauldronX
Attempt to avoid npe during handshake
This commit is contained in:
parent
939bb4b7da
commit
4b0afe6ff9
@ -1,18 +1,19 @@
|
|||||||
--- ../src-base/minecraft/cpw/mods/fml/common/network/internal/HandshakeCompletionHandler.java
|
--- ../src-base/minecraft/cpw/mods/fml/common/network/internal/HandshakeCompletionHandler.java
|
||||||
+++ ../src-work/minecraft/cpw/mods/fml/common/network/internal/HandshakeCompletionHandler.java
|
+++ ../src-work/minecraft/cpw/mods/fml/common/network/internal/HandshakeCompletionHandler.java
|
||||||
@@ -13,9 +13,15 @@
|
@@ -13,8 +13,14 @@
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, CompleteHandshake msg) throws Exception
|
protected void channelRead0(ChannelHandlerContext ctx, CompleteHandshake msg) throws Exception
|
||||||
{
|
{
|
||||||
|
- NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).getAndRemove();
|
||||||
|
- dispatcher.completeHandshake(msg.target);
|
||||||
+ // Cauldron start - attempt to fix race condition with attr being null
|
+ // Cauldron start - attempt to fix race condition with attr being null
|
||||||
+ Object attr = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER);
|
+ io.netty.util.Attribute<NetworkDispatcher> attr = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER);
|
||||||
+ if (attr != null)
|
+ if (attr != null)
|
||||||
+ {
|
+ {
|
||||||
NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).getAndRemove();
|
+ NetworkDispatcher dispatcher = attr.getAndRemove();
|
||||||
dispatcher.completeHandshake(msg.target);
|
+ if (dispatcher != null) dispatcher.completeHandshake(msg.target);
|
||||||
}
|
|
||||||
+ // Cauldron end
|
|
||||||
+ }
|
+ }
|
||||||
|
+ // Cauldron end
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
|
|
||||||
|
Loading…
Reference in New Issue
Block a user