From 2d72e274e3c21fa0f91778b56f886d2e6558cf4c Mon Sep 17 00:00:00 2001 From: extendedclip Date: Thu, 6 Aug 2020 14:08:48 -0400 Subject: [PATCH] account for empty strings --- .../java/me/clip/placeholderapi/replacer/CharsReplacer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/me/clip/placeholderapi/replacer/CharsReplacer.java b/src/main/java/me/clip/placeholderapi/replacer/CharsReplacer.java index a799eda..00a8b96 100644 --- a/src/main/java/me/clip/placeholderapi/replacer/CharsReplacer.java +++ b/src/main/java/me/clip/placeholderapi/replacer/CharsReplacer.java @@ -168,6 +168,9 @@ public final class CharsReplacer implements Replacer { builder.append(ChatColor.translateAlternateColorCodes('&', replacement)); } + if (builder.length() == 0) { + return ""; + } char c = builder.charAt(builder.length() - 1); if (c == ' ') { return builder.substring(0, builder.length() - 1);