#3355,#3357: Fix possible NPE's in LoginEvent & PreLoginEvent

This commit is contained in:
Outfluencer 2022-07-12 21:47:57 +10:00 committed by md_5
parent 587fb37bdf
commit 12e4514813
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -428,7 +428,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{ {
if ( result.isCancelled() ) if ( result.isCancelled() )
{ {
disconnect( result.getCancelReasonComponents() ); BaseComponent[] reason = result.getCancelReasonComponents();
disconnect( ( reason != null ) ? reason : TextComponent.fromLegacyText( bungee.getTranslation( "kick_message" ) ) );
return; return;
} }
if ( ch.isClosed() ) if ( ch.isClosed() )
@ -551,7 +552,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{ {
if ( result.isCancelled() ) if ( result.isCancelled() )
{ {
disconnect( result.getCancelReasonComponents() ); BaseComponent[] reason = result.getCancelReasonComponents();
disconnect( ( reason != null ) ? reason : TextComponent.fromLegacyText( bungee.getTranslation( "kick_message" ) ) );
return; return;
} }
if ( ch.isClosed() ) if ( ch.isClosed() )