am bb9a8e08: am f463b45d: Merge "Fix Possible NPE"

* commit 'bb9a8e082aebbcdd46e4d2378d9839f896c15476':
  Fix Possible NPE
main
Satoshi Kataoka 2013-04-03 19:21:01 -07:00 committed by Android Git Automerger
commit 395e500b09
1 changed files with 6 additions and 1 deletions

View File

@ -207,7 +207,12 @@ public final class UserHistoryDictIOUtils {
final ArrayList<PendingAttribute> attrList = bigrams.get(entry.getKey());
if (attrList != null) {
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,
attr.mFrequency));
}