thest1/LazyList — Issue #4: Clear() in FileCache.java throws NullPointerException
Author: Adaei
Created: 2012-01-05 11:26:31+00:00
State: open

When you do not have permissions setup for external storage and you clear the cache of the application, then reload it and try and clear the cache onload using 'clear()'. It has a null value for 'files' variable and crashes. So I put this null pointer check in here just in case it is ever null again :)

FileCache.java

public void clear(){
File[] files=cacheDir.listFiles();
if (files != null)
{
for(File f:files)
f.delete();
}
}