Skip to content

Commit ebc78f3

Browse files
Merge pull request #530 from nextcloud/fixAutoUploadViewNPE
Fix NPE and improve performance of Auto Upload view
2 parents b38ed61 + b25f9ec commit ebc78f3

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
-->
2121
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2222
package="com.owncloud.android"
23-
android:versionCode="10040102"
24-
android:versionName="1.4.1 RC2">
23+
android:versionCode="10040103"
24+
android:versionName="1.4.1 RC3">
2525

2626
<uses-sdk
2727
android:minSdkVersion="14"

src/com/owncloud/android/datamodel/MediaProvider.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,25 @@ public static List<MediaFolder> getMediaFolders(ContentResolver contentResolver,
9191
}
9292
cursorImages.close();
9393

94-
// count images
95-
Cursor count = contentResolver.query(
96-
MEDIA_URI,
97-
FILE_PROJECTION,
98-
FILE_SELECTION + folderId,
99-
null,
100-
null);
101-
102-
if (count != null) {
103-
mediaFolder.numberOfFiles = count.getCount();
104-
count.close();
94+
// only do further work if folder is not within the Nextcloud app itself
95+
if (!mediaFolder.absolutePath.startsWith(dataPath)) {
96+
97+
// count images
98+
Cursor count = contentResolver.query(
99+
MEDIA_URI,
100+
FILE_PROJECTION,
101+
FILE_SELECTION + folderId,
102+
null,
103+
null);
104+
105+
if (count != null) {
106+
mediaFolder.numberOfFiles = count.getCount();
107+
count.close();
108+
}
109+
110+
mediaFolders.add(mediaFolder);
105111
}
106112
}
107-
if (!mediaFolder.absolutePath.startsWith(dataPath)) {
108-
mediaFolders.add(mediaFolder);
109-
}
110113
}
111114
cursorFolders.close();
112115
}

0 commit comments

Comments
 (0)