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

Commit e4bea2d7 authored by Daniel Nishi's avatar Daniel Nishi
Browse files

Fix an NPE when FileCollector runs.

In some cases, the path for a VolumeInfo may be null. The previous
implementation assumed it was always non-null, however. This backs out
of the calculation early if we cannot find the files.

Change-Id: Icfe265be738c5ccb16917ef339b2b872f2057f07
Fixes: 38308873
Test: No observed phone crashes with a flashed build.
parent db083677
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -203,7 +203,13 @@ public class FileCollector {
            return 0;
        }

        final long sharedDataSize = shared.getPath().getTotalSpace();
        // In some cases, the path may be null -- we can't determine the size in this case.
        final File sharedPath = shared.getPath();
        if (sharedPath == null) {
          return 0;
        }

        final long sharedDataSize = sharedPath.getTotalSpace();
        long systemSize = sm.getPrimaryStorageSize() - sharedDataSize;

        // This case is not exceptional -- we just fallback to the shared data volume in this case.