Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1870e92 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Handle null value returned by MtpDevice#getRoots.

BUG=23169303

Change-Id: I9602dda01f3b8919a471c1f4c88acdd19f391684
parent 5e491c91
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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]));