1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 16:58:51 -05:00

* allow null parameter

This commit is contained in:
Reinhard Pointner 2014-04-28 04:31:10 +00:00
parent a8e52145f4
commit b315e9e9ea

View File

@ -182,9 +182,12 @@ public class ExpressionFormatMethods {
} }
/** /**
* Find MatchResult that matches the given pattern (case-insensitive) * Find a matcher that matches the given pattern (case-insensitive)
*/ */
public static Matcher findMatch(String self, String pattern) { public static Matcher findMatch(String self, String pattern) {
if (pattern == null)
return null;
Matcher matcher = compile(pattern, CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS).matcher(self); Matcher matcher = compile(pattern, CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS).matcher(self);
return matcher.find() ? matcher.reset() : null; return matcher.find() ? matcher.reset() : null;
} }