Fix NPE when converting invalid color character from legacy text

This commit is contained in:
Jonas Konrad 2014-03-15 19:56:19 +01:00
parent 92ebce2ec6
commit c29676e4fc

View File

@ -42,6 +42,8 @@ public class TextComponent extends BaseComponent
{ {
i++; i++;
c = message.charAt( i ); c = message.charAt( i );
ChatColor format = ChatColor.getByChar( c );
if ( format == null ) continue;
if ( c >= 'A' && c <= 'Z' ) if ( c >= 'A' && c <= 'Z' )
{ {
c += 32; c += 32;
@ -54,7 +56,6 @@ public class TextComponent extends BaseComponent
builder = new StringBuilder(); builder = new StringBuilder();
components.add( old ); components.add( old );
} }
ChatColor format = ChatColor.getByChar( c );
switch ( format ) switch ( format )
{ {
case BOLD: case BOLD: