Skip to content

Commit 14ec654

Browse files
committed
Ensure connection is active before initializing addon
1 parent 658e2a0 commit 14ec654

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/mixin/networking/client/ClientPlayNetworkHandlerMixin.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ protected ClientPlayNetworkHandlerMixin(Minecraft client, Connection connection,
4949

5050
@Inject(method = "<init>", at = @At("RETURN"))
5151
private void initAddon(CallbackInfo ci) {
52+
if (!this.getConnection().isConnected()) {
53+
return;
54+
}
55+
5256
Set<ResourceLocation> channels = ChannelAttributes.getOrCreateCommonChannels(this.getConnection(), this.protocol());
5357
NeoClientCommonNetworking.onRegisterPacket((ClientPacketListener) (Object) this, channels);
5458

0 commit comments

Comments
 (0)