Make up for the missing condition judgment in last commit

This commit is contained in:
Isaac_Chen 2020-04-21 22:32:30 +08:00
parent be2c17d2d3
commit b674d6351a

View file

@ -216,6 +216,9 @@ public abstract class SearchableBaseNoteFragment extends BaseNoteFragment {
}
private static int countOccurrences(String haystack, String needle) {
if (haystack == null || haystack.isEmpty() || needle == null || needle.isEmpty()) {
return 0;
}
Matcher m = Pattern.compile(needle, Pattern.CASE_INSENSITIVE | Pattern.LITERAL)
.matcher(haystack);