Skip to content

Commit

Permalink
work around the problem that for some reason, getCacheDir can come ba…
Browse files Browse the repository at this point in the history
…ck with NULL
  • Loading branch information
mttkay committed Mar 30, 2011
1 parent a6e1c64 commit c6557a4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/com/github/droidfu/cachefu/AbstractCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ public boolean enableDiskCache(Context context, int storageDevice) {
rootDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/"
+ appContext.getPackageName() + "/cache";
} else {
rootDir = appContext.getCacheDir().getAbsolutePath();
File internalCacheDir = appContext.getCacheDir();
// apparently on some configurations this can come back as null
if (internalCacheDir == null) {
return (isDiskCacheEnabled = false);
}
rootDir = internalCacheDir.getAbsolutePath();
}

setRootDir(rootDir);
Expand Down

0 comments on commit c6557a4

Please sign in to comment.