Pārlūkot izejas kodu

Catch null contentUri (#343)

Andrew Jack 7 gadus atpakaļ
vecāks
revīzija
ecbf535150

+ 8
- 6
android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java Parādīt failu

@@ -641,12 +641,14 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
641 641
                         return;
642 642
                     }
643 643
                     String contentUri = c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
644
-                    Uri uri = Uri.parse(contentUri);
645
-                    Cursor cursor = appCtx.getContentResolver().query(uri, new String[]{android.provider.MediaStore.Images.ImageColumns.DATA}, null, null, null);
646
-                    // use default destination of DownloadManager
647
-                    if (cursor != null) {
648
-                        cursor.moveToFirst();
649
-                        filePath = cursor.getString(0);
644
+                    if (contentUri != null) {
645
+                        Uri uri = Uri.parse(contentUri);
646
+                        Cursor cursor = appCtx.getContentResolver().query(uri, new String[]{android.provider.MediaStore.Images.ImageColumns.DATA}, null, null, null);
647
+                        // use default destination of DownloadManager
648
+                        if (cursor != null) {
649
+                            cursor.moveToFirst();
650
+                            filePath = cursor.getString(0);
651
+                        }
650 652
                     }
651 653
                 }
652 654
                 // When the file is not found in media content database, check if custom path exists