Merge pull request #1201 from nextcloud/autoUploadCrashIfFilepathIsNull

Auto upload crash if filepath is null
This commit is contained in:
Andy Scherzinger 2017-07-28 14:36:48 +02:00 committed by GitHub
commit 13b841b67f
2 changed files with 10 additions and 4 deletions

View file

@ -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();
}

View file

@ -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"/>