Commit c0437e6d authored by Edward Wang's avatar Edward Wang

Don't crash if there are no subdirectories or they are inaccessible

Close #6979
parent 31e148e2
......@@ -90,6 +90,12 @@ public class BrowserActivity extends ListActivity {
mAdapter.clear();
mCurrentDir = file;
File[] files = file.listFiles(new DirFilter());
/* If no sub-directories or I/O error don't crash */
if(files == null || files.length < 1) {
Util.toaster(this, R.string.nosubdirectory);
this.finish();
return;
}
for (int i = 0; i < files.length; i++) {
mAdapter.add(files[i]);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment