Merge "Gracefully handle null volumes after forgetting." into oc-dev

This commit is contained in:
Daniel Nishi
2017-04-20 17:05:28 +00:00
committed by Android (Google) Code Review
2 changed files with 62 additions and 0 deletions

View File

@@ -53,8 +53,18 @@ public class PrivateVolumeForget extends SettingsPreferenceFragment {
Bundle savedInstanceState) {
final StorageManager storage = getActivity().getSystemService(StorageManager.class);
final String fsUuid = getArguments().getString(VolumeRecord.EXTRA_FS_UUID);
// Passing null will crash the StorageManager, so let's early exit.
if (fsUuid == null) {
getActivity().finish();
return null;
}
mRecord = storage.findRecordByUuid(fsUuid);
if (mRecord == null) {
getActivity().finish();
return null;
}
final View view = inflater.inflate(R.layout.storage_internal_forget, container, false);
final TextView body = (TextView) view.findViewById(R.id.body);
final Button confirm = (Button) view.findViewById(R.id.confirm);