fix: Improve error handling for regex filter

This commit is contained in:
Ben Woo 2023-02-14 00:30:44 +08:00
parent 1e711ac258
commit 15ae0ea54f
1 changed files with 6 additions and 1 deletions

View File

@ -69,7 +69,12 @@ public class RegexContentFilter implements ContentFilter {
return false;
}
String text = ChatColor.stripColor(String.valueOf(value));
return regexPattern.matcher(text).find();
try {
return regexPattern.matcher(text).find();
} catch (PatternSyntaxException ignored) {
Logging.fine("Error parsing regex '%s' for input '%s'", regexString, text);
return false;
}
}
/**