Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2692d9b authored by Xiaojun Bi's avatar Xiaojun Bi Committed by The Android Automerger
Browse files

Fix a NPE in DistracterFilter.isDistracterToWordsInDictionaries()

Bug: 14904706
Change-Id: I3b52bb01b9c59cbba2eba0bd1d91dffb4419c019
parent 15531c49
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -90,19 +90,14 @@ public class DistracterFilter {
     */
    public boolean isDistracterToWordsInDictionaries(final String prevWord,
            final String testedWord) {
        if (mSuggest == null) {
        if (mSuggest == null || mKeyboard == null) {
            return false;
        }

        final WordComposer composer = new WordComposer();
        final int[] codePoints = StringUtils.toCodePointArray(testedWord);
        final int[] coordinates;
        if (null == mKeyboard) {
            coordinates = CoordinateUtils.newCoordinateArray(codePoints.length,
                    Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
        } else {
        coordinates = mKeyboard.getCoordinates(codePoints);
        }
        composer.setComposingWord(codePoints, coordinates, prevWord);

        final int trailingSingleQuotesCount = composer.trailingSingleQuotesCount();