Move regex pattern initialization

If text == null, then the Pattern is not used.
This commit is contained in:
Romain Vimont 2025-04-25 10:23:08 +02:00
commit 91a4a74641

View file

@ -95,12 +95,12 @@ public final class DisplayManager {
} }
private static int parseDisplayFlags(String text) { private static int parseDisplayFlags(String text) {
Pattern regex = Pattern.compile("FLAG_[A-Z_]+");
if (text == null) { if (text == null) {
return 0; return 0;
} }
int flags = 0; int flags = 0;
Pattern regex = Pattern.compile("FLAG_[A-Z_]+");
Matcher m = regex.matcher(text); Matcher m = regex.matcher(text);
while (m.find()) { while (m.find()) {
String flagString = m.group(); String flagString = m.group();