Merge "Fix: NPE when context.getFilesDir() returns null."

main
Keisuke Kuroyanagi 2014-05-16 05:35:56 +00:00 committed by Android (Google) Code Review
commit cfd3093362
1 changed files with 6 additions and 4 deletions

View File

@ -138,11 +138,13 @@ public class PersonalizationHelper {
}
}
dictionaryMap.clear();
if (!FileUtils.deleteFilteredFiles(
context.getFilesDir(), new DictFilter(dictNamePrefix))) {
final File filesDir = context.getFilesDir();
if (filesDir == null) {
Log.e(TAG, "context.getFilesDir() returned null.");
}
if (!FileUtils.deleteFilteredFiles(filesDir, new DictFilter(dictNamePrefix))) {
Log.e(TAG, "Cannot remove all existing dictionary files. filesDir: "
+ context.getFilesDir().getAbsolutePath() + ", dictNamePrefix: "
+ dictNamePrefix);
+ filesDir.getAbsolutePath() + ", dictNamePrefix: " + dictNamePrefix);
}
}
}