1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

fixed very rare NullPointerException

This commit is contained in:
Marcus Wolschon 2011-04-19 09:01:01 +02:00
parent 724b6eaaa5
commit 59399506df

View File

@ -72,7 +72,14 @@ public class AttachmentProvider extends ContentProvider {
* We use the cache dir as a temporary directory (since Android doesn't give us one) so
* on startup we'll clean up any .tmp files from the last run.
*/
File[] files = getContext().getCacheDir().listFiles();
final File cacheDir = getContext().getCacheDir();
if (cacheDir == null) {
return true;
}
File[] files = cacheDir.listFiles();
if (files == null) {
return true;
}
for (File file : files) {
if (file.getName().endsWith(".tmp")) {
file.delete();