From c29676e4fc8a109c0466b6cd6f30d96f19ab34f9 Mon Sep 17 00:00:00 2001 From: Jonas Konrad Date: Sat, 15 Mar 2014 19:56:19 +0100 Subject: [PATCH] Fix NPE when converting invalid color character from legacy text --- api/src/main/java/net/md_5/bungee/api/chat/TextComponent.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 529ea2bb..c4dbb640 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 @@ -42,6 +42,8 @@ public class TextComponent extends BaseComponent { i++; c = message.charAt( i ); + ChatColor format = ChatColor.getByChar( c ); + if ( format == null ) continue; if ( c >= 'A' && c <= 'Z' ) { c += 32; @@ -54,7 +56,6 @@ public class TextComponent extends BaseComponent builder = new StringBuilder(); components.add( old ); } - ChatColor format = ChatColor.getByChar( c ); switch ( format ) { case BOLD: