Skip to content

Commit

Permalink
Fix crash searching illegal characters
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Apr 15, 2024
1 parent 2af03ce commit a231c65
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import java.util.Locale;
import java.util.function.UnaryOperator;
import java.util.regex.Pattern;

import static me.shedaniel.rei.impl.client.gui.config.options.ConfigUtils.literal;

Expand Down Expand Up @@ -106,7 +107,7 @@ public static MutableComponent highlightText(MutableComponent component, @Nullab
if (string.toLowerCase(Locale.ROOT).equals(highlight.toLowerCase(Locale.ROOT))) {
return component.withStyle(styleOperator).withStyle(ChatFormatting.YELLOW);
}
String[] parts = string.toLowerCase(Locale.ROOT).split(highlight.toLowerCase(Locale.ROOT));
String[] parts = string.toLowerCase(Locale.ROOT).split(Pattern.quote(highlight.toLowerCase(Locale.ROOT)));
if (string.toLowerCase(Locale.ROOT).endsWith(highlight.toLowerCase(Locale.ROOT))) {
// Append an empty string to the end
String[] newParts = new String[parts.length + 1];
Expand Down

0 comments on commit a231c65

Please sign in to comment.