am f463b45d: Merge "Fix Possible NPE"
* commit 'f463b45d8e0f6603446496b38aaf45db7e4bb5dd': Fix Possible NPEmain
commit
bb9a8e082a
|
@ -207,7 +207,12 @@ public final class UserHistoryDictIOUtils {
|
||||||
final ArrayList<PendingAttribute> attrList = bigrams.get(entry.getKey());
|
final ArrayList<PendingAttribute> attrList = bigrams.get(entry.getKey());
|
||||||
if (attrList != null) {
|
if (attrList != null) {
|
||||||
for (final PendingAttribute attr : attrList) {
|
for (final PendingAttribute attr : attrList) {
|
||||||
to.setBigram(word1, unigrams.get(attr.mAddress),
|
final String word2 = unigrams.get(attr.mAddress);
|
||||||
|
if (word1 == null || word2 == null) {
|
||||||
|
Log.e(TAG, "Invalid bigram pair detected: " + word1 + ", " + word2);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
to.setBigram(word1, word2,
|
||||||
BinaryDictInputOutput.reconstructBigramFrequency(unigramFrequency,
|
BinaryDictInputOutput.reconstructBigramFrequency(unigramFrequency,
|
||||||
attr.mFrequency));
|
attr.mFrequency));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue