Fix countWords npe
This commit is contained in:
parent
32218bb481
commit
a0005dccbb
1 changed files with 7 additions and 5 deletions
|
@ -229,12 +229,14 @@ public class SearchPhrase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int countWords(String w) {
|
public int countWords(String w) {
|
||||||
String[] ws = w.split(ALLDELIMITERS);
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for (int i = 0; i < ws.length; i++) {
|
if (!Algorithms.isEmpty(w)) {
|
||||||
String wd = ws[i].trim();
|
String[] ws = w.split(ALLDELIMITERS);
|
||||||
if (wd.length() > 0) {
|
for (int i = 0; i < ws.length; i++) {
|
||||||
cnt++;
|
String wd = ws[i].trim();
|
||||||
|
if (wd.length() > 0) {
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
|
|
Loading…
Reference in a new issue