am ee599754: Merge "Fix a NPE in DistracterFilter.isDistracterToWordsInDictionaries()"
* commit 'ee59975420c975040c0b990812201d3ddb4aacc5': Fix a NPE in DistracterFilter.isDistracterToWordsInDictionaries()main
commit
4d1eaa12c9
|
@ -90,19 +90,14 @@ public class DistracterFilter {
|
||||||
*/
|
*/
|
||||||
public boolean isDistracterToWordsInDictionaries(final String prevWord,
|
public boolean isDistracterToWordsInDictionaries(final String prevWord,
|
||||||
final String testedWord) {
|
final String testedWord) {
|
||||||
if (mSuggest == null) {
|
if (mSuggest == null || mKeyboard == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WordComposer composer = new WordComposer();
|
final WordComposer composer = new WordComposer();
|
||||||
final int[] codePoints = StringUtils.toCodePointArray(testedWord);
|
final int[] codePoints = StringUtils.toCodePointArray(testedWord);
|
||||||
final int[] coordinates;
|
final int[] coordinates;
|
||||||
if (null == mKeyboard) {
|
coordinates = mKeyboard.getCoordinates(codePoints);
|
||||||
coordinates = CoordinateUtils.newCoordinateArray(codePoints.length,
|
|
||||||
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
|
|
||||||
} else {
|
|
||||||
coordinates = mKeyboard.getCoordinates(codePoints);
|
|
||||||
}
|
|
||||||
composer.setComposingWord(codePoints, coordinates, prevWord);
|
composer.setComposingWord(codePoints, coordinates, prevWord);
|
||||||
|
|
||||||
final int trailingSingleQuotesCount = composer.trailingSingleQuotesCount();
|
final int trailingSingleQuotesCount = composer.trailingSingleQuotesCount();
|
||||||
|
|
Loading…
Reference in New Issue