diff options
| author | Jeff Brown <jeffbrown@google.com> | 2014-01-28 00:09:42 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-01-28 00:09:42 +0000 |
| commit | df8b604e9bf49bcf9a620e4fe19ccf19c2c49487 (patch) | |
| tree | 09d982452e114d0b649f9a2297a004469cf26798 /core | |
| parent | 065d998a4c3d597e924f42635d1a3699a6fcf34b (diff) | |
| parent | fce5890a11b421532568d9838ae3dd5836acead8 (diff) | |
| download | frameworks_base-df8b604e9bf49bcf9a620e4fe19ccf19c2c49487.zip frameworks_base-df8b604e9bf49bcf9a620e4fe19ccf19c2c49487.tar.gz frameworks_base-df8b604e9bf49bcf9a620e4fe19ccf19c2c49487.tar.bz2 | |
Merge "Fix NPE in deleteDatabase()." into klp-modular-dev
Diffstat (limited to 'core')
| -rw-r--r-- | core/java/android/database/sqlite/SQLiteDatabase.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java index 60ccc61..433d5d1 100644 --- a/core/java/android/database/sqlite/SQLiteDatabase.java +++ b/core/java/android/database/sqlite/SQLiteDatabase.java @@ -738,14 +738,16 @@ public final class SQLiteDatabase extends SQLiteClosable { File dir = file.getParentFile(); if (dir != null) { final String prefix = file.getName() + "-mj"; - final FileFilter filter = new FileFilter() { + File[] files = dir.listFiles(new FileFilter() { @Override public boolean accept(File candidate) { return candidate.getName().startsWith(prefix); } - }; - for (File masterJournal : dir.listFiles(filter)) { - deleted |= masterJournal.delete(); + }); + if (files != null) { + for (File masterJournal : files) { + deleted |= masterJournal.delete(); + } } } return deleted; |
