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 committed by Niedermann IT-Dienstleistungen
parent 20388c2e7b
commit 3b5124e0b2

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);