소스 검색

hardening of video retrieval according to image hardening

AndyScherzinger 7 년 전
부모
커밋
5cead89381
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  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(