From 886ac734f90cfbfcebc9d9b35b3f9aa2ffb1342a Mon Sep 17 00:00:00 2001 From: KennyTV Date: Thu, 23 Apr 2020 21:09:41 +0200 Subject: [PATCH] Add null check to channel close --- .../myles/ViaVersion/api/platform/ViaConnectionManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/platform/ViaConnectionManager.java b/common/src/main/java/us/myles/ViaVersion/api/platform/ViaConnectionManager.java index 77ac1b6e1..f44fb777e 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/platform/ViaConnectionManager.java +++ b/common/src/main/java/us/myles/ViaVersion/api/platform/ViaConnectionManager.java @@ -20,7 +20,9 @@ public class ViaConnectionManager { connections.add(connection); clients.put(id, connection); - connection.getChannel().closeFuture().addListener((ChannelFutureListener) future -> onDisconnect(connection)); + if (connection.getChannel() != null) { + connection.getChannel().closeFuture().addListener((ChannelFutureListener) future -> onDisconnect(connection)); + } } public void onDisconnect(UserConnection connection) {