No more NULL pointers from getDirectoryContent (2)

This commit is contained in:
David A. Velasco 2012-11-30 13:33:23 +01:00
parent e81a7790eb
commit b59784af89
2 changed files with 3 additions and 3 deletions

View file

@ -257,7 +257,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
// click on folder in the list // click on folder in the list
Log.d(TAG, "on item click"); Log.d(TAG, "on item click");
Vector<OCFile> tmpfiles = mStorageManager.getDirectoryContent(mFile); Vector<OCFile> tmpfiles = mStorageManager.getDirectoryContent(mFile);
if (tmpfiles == null) return; if (tmpfiles.size() <= 0) return;
// filter on dirtype // filter on dirtype
Vector<OCFile> files = new Vector<OCFile>(); Vector<OCFile> files = new Vector<OCFile>();
for (OCFile f : tmpfiles) for (OCFile f : tmpfiles)
@ -325,7 +325,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
mFile = mStorageManager.getFileByPath(full_path); mFile = mStorageManager.getFileByPath(full_path);
if (mFile != null) { if (mFile != null) {
Vector<OCFile> files = mStorageManager.getDirectoryContent(mFile); Vector<OCFile> files = mStorageManager.getDirectoryContent(mFile);
if (files != null) { if (files.size() > 0) {
List<HashMap<String, Object>> data = new LinkedList<HashMap<String,Object>>(); List<HashMap<String, Object>> data = new LinkedList<HashMap<String,Object>>();
for (OCFile f : files) { for (OCFile f : files) {
HashMap<String, Object> h = new HashMap<String, Object>(); HashMap<String, Object> h = new HashMap<String, Object>();

View file

@ -456,7 +456,7 @@ public class FileDataStorageManager implements DataStorageManager {
// TODO consider possible failures // TODO consider possible failures
if (dir != null && dir.isDirectory() && dir.getFileId() != -1) { if (dir != null && dir.isDirectory() && dir.getFileId() != -1) {
Vector<OCFile> children = getDirectoryContent(dir); Vector<OCFile> children = getDirectoryContent(dir);
if (children != null) { if (children.size() > 0) {
OCFile child = null; OCFile child = null;
for (int i=0; i<children.size(); i++) { for (int i=0; i<children.size(); i++) {
child = children.get(i); child = children.get(i);