From b0a8371570f083b162502f0353e3debb1b967ecd Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Thu, 2 Jan 2014 15:39:38 +0000 Subject: [PATCH] Fix client crash when an empty message is sent using TextComponent.fromLegacyText --- .../main/java/net/md_5/bungee/api/chat/TextComponent.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/src/main/java/net/md_5/bungee/api/chat/TextComponent.java b/api/src/main/java/net/md_5/bungee/api/chat/TextComponent.java index e1c68c07..9c297ecd 100644 --- a/api/src/main/java/net/md_5/bungee/api/chat/TextComponent.java +++ b/api/src/main/java/net/md_5/bungee/api/chat/TextComponent.java @@ -110,6 +110,12 @@ public class TextComponent extends BaseComponent component.setText( builder.toString() ); components.add( component ); } + + //The client will crash if the array is empty + if ( components.size() == 0 ) { + components.add( new TextComponent( "" ) ); + } + return components.toArray( new BaseComponent[components.size()] ); }