Skip to content

Commit

Permalink
Merge pull request #530 from nextcloud/fixAutoUploadViewNPE
Browse files Browse the repository at this point in the history
Fix NPE and improve performance of Auto Upload view
  • Loading branch information
AndyScherzinger authored Jan 11, 2017
2 parents b38ed61 + b25f9ec commit ebc78f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.owncloud.android"
android:versionCode="10040102"
android:versionName="1.4.1 RC2">
android:versionCode="10040103"
android:versionName="1.4.1 RC3">

<uses-sdk
android:minSdkVersion="14"
Expand Down
31 changes: 17 additions & 14 deletions src/com/owncloud/android/datamodel/MediaProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,25 @@ public static List<MediaFolder> getMediaFolders(ContentResolver contentResolver,
}
cursorImages.close();

// count images
Cursor count = contentResolver.query(
MEDIA_URI,
FILE_PROJECTION,
FILE_SELECTION + folderId,
null,
null);

if (count != null) {
mediaFolder.numberOfFiles = count.getCount();
count.close();
// only do further work if folder is not within the Nextcloud app itself
if (!mediaFolder.absolutePath.startsWith(dataPath)) {

// count images
Cursor count = contentResolver.query(
MEDIA_URI,
FILE_PROJECTION,
FILE_SELECTION + folderId,
null,
null);

if (count != null) {
mediaFolder.numberOfFiles = count.getCount();
count.close();
}

mediaFolders.add(mediaFolder);
}
}
if (!mediaFolder.absolutePath.startsWith(dataPath)) {
mediaFolders.add(mediaFolder);
}
}
cursorFolders.close();
}
Expand Down

0 comments on commit ebc78f3

Please sign in to comment.