mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-27 02:48:04 +01:00
Allow null messages in ColorUtil.
This commit is contained in:
parent
c8c7bbb37c
commit
959c6c7be8
@ -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 (!).
|
||||
@ -62,7 +62,7 @@ public class ColorUtil {
|
||||
* @return the string
|
||||
*/
|
||||
public static String replaceColors(final String text) {
|
||||
return ChatColor.translateAlternateColorCodes('&', text);
|
||||
return text == null ? null : ChatColor.translateAlternateColorCodes('&', text);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user