account for empty strings

This commit is contained in:
extendedclip 2020-08-06 14:08:48 -04:00
parent b73d00e169
commit 2d72e274e3

View File

@ -168,6 +168,9 @@ public final class CharsReplacer implements Replacer {
builder.append(ChatColor.translateAlternateColorCodes('&', replacement)); builder.append(ChatColor.translateAlternateColorCodes('&', replacement));
} }
if (builder.length() == 0) {
return "";
}
char c = builder.charAt(builder.length() - 1); char c = builder.charAt(builder.length() - 1);
if (c == ' ') { if (c == ' ') {
return builder.substring(0, builder.length() - 1); return builder.substring(0, builder.length() - 1);