am 097e75ef: Merge "Fix: -1 can be used as a code point of most probable string."

* commit '097e75efc783c68f38612319c055e783767b8581':
  Fix: -1 can be used as a code point of most probable string.
main
Keisuke Kuroyanagi 2014-02-24 05:57:22 -08:00 committed by Android Git Automerger
commit c23ba814d2
1 changed files with 10 additions and 1 deletions

View File

@ -992,7 +992,16 @@ namespace latinime {
} }
} }
if (character != NOT_AN_INDEX) { if (character != NOT_AN_INDEX) {
codePointBuf[index] = proximityInfo->getCodePointOf(character); const int codePoint = proximityInfo->getCodePointOf(character);
if (codePoint == NOT_A_CODE_POINT) {
AKLOGE("Key index(%d) is not found. Cannot construct most probable string",
character);
ASSERT(false);
// Make the length zero, which means most probable string won't be used.
index = 0;
break;
}
codePointBuf[index] = codePoint;
index++; index++;
} }
sumLogProbability += minLogProbability; sumLogProbability += minLogProbability;