Skip to content

Commit

Permalink
Allow null messages in ColorUtil.
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed Aug 17, 2013
1 parent c8c7bbb commit 959c6c7
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -20,7 +20,7 @@ public class ColorUtil {
* @return Either the object reference itself, or a copy with color definitions removed.
*/
public static String removeColors(final String text) {
if (text.length() <= 1) return text;
if (text == null || text.length() <= 1) return text;
final char[] chars = text.toCharArray();
// First find a begin index at all.
// TODO: Consider removing the normal color char as well (!).
Expand Down Expand Up @@ -62,7 +62,7 @@ public static String removeColors(final String text) {
* @return the string
*/
public static String replaceColors(final String text) {
return ChatColor.translateAlternateColorCodes('&', text);
return text == null ? null : ChatColor.translateAlternateColorCodes('&', text);
}

}

0 comments on commit 959c6c7

Please sign in to comment.