diff options
author | 2014-02-24 05:57:22 -0800 | |
---|---|---|
committer | 2014-02-24 05:57:22 -0800 | |
commit | c23ba814d2593fdf91547d15a594032144aa9c7a (patch) | |
tree | d153b0844f19df66389bcd9893f85f78c57a2d8b | |
parent | 8cbcbb4170b8f4107d2a511249a002ddab6ae1b3 (diff) | |
parent | 097e75efc783c68f38612319c055e783767b8581 (diff) | |
download | latinime-c23ba814d2593fdf91547d15a594032144aa9c7a.tar.gz latinime-c23ba814d2593fdf91547d15a594032144aa9c7a.tar.xz latinime-c23ba814d2593fdf91547d15a594032144aa9c7a.zip |
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.
-rw-r--r-- | native/jni/src/suggest/core/layout/proximity_info_state_utils.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/native/jni/src/suggest/core/layout/proximity_info_state_utils.cpp b/native/jni/src/suggest/core/layout/proximity_info_state_utils.cpp index e1b35340b..bc4ca8e9e 100644 --- a/native/jni/src/suggest/core/layout/proximity_info_state_utils.cpp +++ b/native/jni/src/suggest/core/layout/proximity_info_state_utils.cpp @@ -992,7 +992,16 @@ namespace latinime { } } 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++; } sumLogProbability += minLogProbability; |