Adding null check on VolumeInfo
Storage manager returns null volumeInfo for a volume that is ejected.
Adding a null check to prevent crashing system ui.
Bug: b/28211502
Change-Id: Icd18dda8cad4e6020df3e4c5b3be6daaa3b22fbe
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 2c53e29..36dd727 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -654,8 +654,9 @@
intent.putExtra(PackageManager.EXTRA_MOVE_ID, move.moveId);
final VolumeInfo vol = mStorageManager.findVolumeByQualifiedUuid(move.volumeUuid);
- intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
-
+ if (vol != null) {
+ intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
+ }
return PendingIntent.getActivityAsUser(mContext, move.moveId, intent,
PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
}