Strengthen java code against bad returns from native
This doesn't really fix the following bug but it may alleviate the symptoms Bug: 6191885 Change-Id: I0de3f550cc7c6cdf79b291399785ad31b205d2ac
This commit is contained in:
parent
1fe943aabd
commit
6ca3ac08ed
1 changed files with 3 additions and 0 deletions
|
@ -149,6 +149,9 @@ public class BinaryDictionary extends Dictionary {
|
||||||
int count = getBigramsNative(mNativeDict, chars, chars.length, mInputCodes, codesSize,
|
int count = getBigramsNative(mNativeDict, chars, chars.length, mInputCodes, codesSize,
|
||||||
mOutputChars_bigrams, mBigramScores, MAX_WORD_LENGTH, MAX_BIGRAMS,
|
mOutputChars_bigrams, mBigramScores, MAX_WORD_LENGTH, MAX_BIGRAMS,
|
||||||
MAX_PROXIMITY_CHARS_SIZE);
|
MAX_PROXIMITY_CHARS_SIZE);
|
||||||
|
if (count > MAX_BIGRAMS) {
|
||||||
|
count = MAX_BIGRAMS;
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; j < count; ++j) {
|
for (int j = 0; j < count; ++j) {
|
||||||
if (codesSize > 0 && mBigramScores[j] < 1) break;
|
if (codesSize > 0 && mBigramScores[j] < 1) break;
|
||||||
|
|
Loading…
Reference in a new issue