diff options
| author | 2015-08-17 18:01:23 +0900 | |
|---|---|---|
| committer | 2015-08-17 18:17:33 +0900 | |
| commit | b1870e922e9e149f632bddcd8b50fcc8220014d7 (patch) | |
| tree | f3e67ac745ef835da54984532b529ea9dddd3607 | |
| parent | 5e491c91e85998cbb42d796aec507431b05068ba (diff) | |
Handle null value returned by MtpDevice#getRoots.
BUG=23169303
Change-Id: I9602dda01f3b8919a471c1f4c88acdd19f391684
| -rw-r--r-- | packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java index 088315787e8f..3afc173fcc52 100644 --- a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java +++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java @@ -95,6 +95,9 @@ class MtpManager { synchronized MtpRoot[] getRoots(int deviceId) throws IOException { final MtpDevice device = getDevice(deviceId); final int[] storageIds = device.getStorageIds(); + if (storageIds == null) { + throw new IOException("Failed to obtain storage IDs."); + } final MtpRoot[] results = new MtpRoot[storageIds.length]; for (int i = 0; i < storageIds.length; i++) { results[i] = new MtpRoot(deviceId, device.getStorageInfo(storageIds[i])); |