From 673275cbc6c6fbef3b33a7493f93470c8d953bef Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 18 Sep 2013 21:39:30 +0900 Subject: [PATCH] Fix an NPE. Apparently, it is possible that File#getPath() returns null. In this case, we'll have a null AssetFileAddress and an NPE later down the road. Bug: 9944824 Change-Id: Id6ceac1cb55439660f9811cf0fe3b574200d5a20 --- .../com/android/inputmethod/latin/BinaryDictionaryGetter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java index 566184244..181ad17ea 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java @@ -286,7 +286,8 @@ final public class BinaryDictionaryGetter { } if (!dictPackSettings.isWordListActive(wordListId)) continue; if (canUse) { - fileList.add(AssetFileAddress.makeFromFileName(f.getPath())); + final AssetFileAddress afa = AssetFileAddress.makeFromFileName(f.getPath()); + if (null != afa) fileList.add(afa); } else { Log.e(TAG, "Found a cached dictionary file but cannot read or use it"); }