Merge pull request #935 from yawkat/fix-legacy-convert-npe

Fix NPE when converting invalid color character from legacy text (Fixes #934)
This commit is contained in:
thinkofdeath 2014-03-15 19:24:00 +00:00
commit a8584f81ed

View File

@ -46,6 +46,8 @@ public class TextComponent extends BaseComponent
{ {
c += 32; c += 32;
} }
ChatColor format = ChatColor.getByChar( c );
if ( format == null ) continue;
if ( builder.length() > 0 ) if ( builder.length() > 0 )
{ {
TextComponent old = component; TextComponent old = component;
@ -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: