Browse Source

hardening of video retrieval according to image hardening

AndyScherzinger 7 years ago
parent
commit
5cead89381
1 changed files with 6 additions and 3 deletions
  1. 6 3
      src/main/java/com/owncloud/android/datamodel/MediaProvider.java

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

@@ -224,13 +224,16 @@ public class MediaProvider {
                     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("/"));
+                        }
                     }
                     cursorImages.close();
 
                     // only do further work if folder is not within the Nextcloud app itself
-                    if (!mediaFolder.absolutePath.startsWith(dataPath)) {
+                    if (mediaFolder.absolutePath != null && !mediaFolder.absolutePath.startsWith(dataPath)) {
 
                         // count images
                         Cursor count = contentResolver.query(