diff --git a/app/src/main/java/slowscript/warpinator/Transfer.java b/app/src/main/java/slowscript/warpinator/Transfer.java index b1a45c5..99339bb 100644 --- a/app/src/main/java/slowscript/warpinator/Transfer.java +++ b/app/src/main/java/slowscript/warpinator/Transfer.java @@ -148,6 +148,8 @@ private void resolveTreeUri(Uri rootUri, String docId, String parent) { Uri childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(rootUri, docId); ArrayList items = resolveUri(childrenUri); for (MFile f : items) { + if (f.documentID == null) + break; //Provider is broken, what can we do... f.uri = DocumentsContract.buildDocumentUriUsingTree(rootUri, f.documentID); f.relPath = parent + "/" + f.name; if (f.isDirectory) { @@ -171,8 +173,10 @@ private ArrayList resolveUri(Uri u) { while (c.moveToNext()) { MFile f = new MFile(); - f.documentID = c.getString(idCol); - f.name = c.getString(nameCol); + if (idCol != -1) + f.documentID = c.getString(idCol); + else Log.w(TAG, "Could not get document ID"); + f.name = c.getString(nameCol); //Name is mandatory if (mimeCol != -1) f.mime = c.getString(mimeCol); else { @@ -183,7 +187,7 @@ private ArrayList resolveUri(Uri u) { f.lastMod = c.getLong(mTimeCol); else f.lastMod = -1; - f.length = c.getLong(sizeCol); + f.length = c.getLong(sizeCol); //Size is mandatory f.isDirectory = f.mime.endsWith("directory"); f.uri = u; f.relPath = f.name;