Fix NPE when we can't find the volume for a file.
If for some reason we can't get a volume associated with a file, don't
NPE, and just open through MP.
Bug: 146820192
Test: builds
Change-Id: I362c9222428758cbe97b638622b09d0e40fc27e7
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 0dc41fb..c64c4ff 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -4398,8 +4398,12 @@
redactionInfo.freeOffsets);
}
} else {
+ FuseDaemon daemon = null;
+
StorageVolume volume = mStorageManager.getStorageVolume(file);
- FuseDaemon daemon = ExternalStorageServiceImpl.getFuseDaemon(volume.getId());
+ if (volume != null) {
+ daemon = ExternalStorageServiceImpl.getFuseDaemon(volume.getId());
+ }
ParcelFileDescriptor lowerFsFd = ParcelFileDescriptor.open(file, modeBits);
boolean forRead = (modeBits & ParcelFileDescriptor.MODE_READ_ONLY) != 0;
boolean shouldOpenWithFuse = daemon != null