Fix a bug ending in a NPE in some rare cases.
Change-Id: If8109c6aa29d100eb745f17f0af756bcb6e3cabbmain
parent
e76dbffe00
commit
cad25fc8a7
|
@ -217,7 +217,7 @@ public class FusionDictionary implements Iterable<Word> {
|
||||||
int nodeIndex = findIndexOfChar(mRoot, word[charIndex]);
|
int nodeIndex = findIndexOfChar(mRoot, word[charIndex]);
|
||||||
while (CHARACTER_NOT_FOUND != nodeIndex) {
|
while (CHARACTER_NOT_FOUND != nodeIndex) {
|
||||||
currentGroup = currentNode.mData.get(nodeIndex);
|
currentGroup = currentNode.mData.get(nodeIndex);
|
||||||
differentCharIndex = compareArrays(currentGroup.mChars, word, charIndex) ;
|
differentCharIndex = compareArrays(currentGroup.mChars, word, charIndex);
|
||||||
if (ARRAYS_ARE_EQUAL != differentCharIndex
|
if (ARRAYS_ARE_EQUAL != differentCharIndex
|
||||||
&& differentCharIndex < currentGroup.mChars.length) break;
|
&& differentCharIndex < currentGroup.mChars.length) break;
|
||||||
if (null == currentGroup.mChildren) break;
|
if (null == currentGroup.mChildren) break;
|
||||||
|
@ -268,7 +268,7 @@ public class FusionDictionary implements Iterable<Word> {
|
||||||
+ new String(word, 0, word.length));
|
+ new String(word, 0, word.length));
|
||||||
}
|
}
|
||||||
final CharGroup newGroup = new CharGroup(word,
|
final CharGroup newGroup = new CharGroup(word,
|
||||||
currentGroup.mBigrams, frequency);
|
currentGroup.mBigrams, frequency, currentGroup.mChildren);
|
||||||
currentNode.mData.set(nodeIndex, newGroup);
|
currentNode.mData.set(nodeIndex, newGroup);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue