浏览代码

Merge pull request #1201 from nextcloud/autoUploadCrashIfFilepathIsNull

Auto upload crash if filepath is null
Andy Scherzinger 7 年之前
父节点
当前提交
13b841b67f

+ 9 - 3
src/main/java/com/owncloud/android/datamodel/MediaProvider.java

@@ -119,11 +119,17 @@ public class MediaProvider {
 
                 if (cursorImages != null) {
                     String filePath;
+                    int failedImages = 0;
                     while (cursorImages.moveToNext()) {
                         filePath = cursorImages.getString(cursorImages.getColumnIndexOrThrow(
                                 MediaStore.MediaColumns.DATA));
-                        mediaFolder.filePaths.add(filePath);
-                        mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf("/"));
+
+                        if (filePath != null) {
+                            mediaFolder.filePaths.add(filePath);
+                            mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf("/"));
+                        } else {
+                            failedImages++;
+                        }
                     }
                     cursorImages.close();
 
@@ -139,7 +145,7 @@ public class MediaProvider {
                                 null);
 
                         if (count != null) {
-                            mediaFolder.numberOfFiles = count.getCount();
+                            mediaFolder.numberOfFiles = count.getCount() - failedImages;
                             count.close();
                         }
 

+ 1 - 1
src/main/res/layout/grid_sync_item.xml

@@ -58,7 +58,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="+"
-                android:textColor="#bcbcbc"
+                android:textColor="#ffffff"
                 android:textSize="22dp"
                 android:textStyle="bold"/>