Skip to content

Commit 16916bd

Browse files
author
Joe Berria
committed
fixed nullpointerexception when going to root directory
1 parent 549f911 commit 16916bd

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/com/nexes/manager/EventHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import android.net.Uri;
2525
import android.os.AsyncTask;
26+
import android.os.Environment;
2627
import android.os.Handler;
2728
import android.os.Message;
2829
import android.app.Activity;
@@ -99,7 +100,8 @@ public EventHandler(Context context, final FileManager manager) {
99100
mContext = context;
100101
mFileMang = manager;
101102

102-
mDataSource = new ArrayList<String>(mFileMang.setHomeDir("/sdcard"));
103+
mDataSource = new ArrayList<String>(mFileMang.setHomeDir
104+
(Environment.getExternalStorageDirectory().getPath()));
103105
}
104106

105107
/**
@@ -719,7 +721,7 @@ public boolean handleMessage(Message msg) {
719721
}
720722

721723
} else if (file != null && file.isDirectory()) {
722-
if (file.list().length > 0)
724+
if (file.canRead() && file.list().length > 0)
723725
mViewHolder.icon.setImageResource(R.drawable.folder_full);
724726
else
725727
mViewHolder.icon.setImageResource(R.drawable.folder);

0 commit comments

Comments
 (0)