Merge "Fix an NPE when FileCollector runs." into oc-dev

This commit is contained in:
Daniel Nishi
2017-06-01 17:29:54 +00:00
committed by Android (Google) Code Review

View File

@@ -203,7 +203,13 @@ public class FileCollector {
return 0; 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; long systemSize = sm.getPrimaryStorageSize() - sharedDataSize;
// This case is not exceptional -- we just fallback to the shared data volume in this case. // This case is not exceptional -- we just fallback to the shared data volume in this case.