From 12e4514813313576990f7687de50c90406723402 Mon Sep 17 00:00:00 2001 From: Outfluencer <48880402+Outfluencer@users.noreply.github.com> Date: Tue, 12 Jul 2022 21:47:57 +1000 Subject: [PATCH] #3355,#3357: Fix possible NPE's in LoginEvent & PreLoginEvent --- .../java/net/md_5/bungee/connection/InitialHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index c5365630..15de64c5 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -428,7 +428,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection { if ( result.isCancelled() ) { - disconnect( result.getCancelReasonComponents() ); + BaseComponent[] reason = result.getCancelReasonComponents(); + disconnect( ( reason != null ) ? reason : TextComponent.fromLegacyText( bungee.getTranslation( "kick_message" ) ) ); return; } if ( ch.isClosed() ) @@ -551,7 +552,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection { if ( result.isCancelled() ) { - disconnect( result.getCancelReasonComponents() ); + BaseComponent[] reason = result.getCancelReasonComponents(); + disconnect( ( reason != null ) ? reason : TextComponent.fromLegacyText( bungee.getTranslation( "kick_message" ) ) ); return; } if ( ch.isClosed() )