Dialer: Voicemail: Don't tear down the app
* When we populate the app with the simulator component and try to
play a voicemail, it takes down the app die to the component name
being null
* Check it before using it
Change-Id: I0de3a611f1ac82198a35de98954d6609eacbeca5
diff --git a/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java b/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
index 147f323..f7a6084 100644
--- a/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
+++ b/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
@@ -117,14 +117,15 @@
}
}
- phoneAccount =
- new PhoneAccountHandle(
- ComponentName.unflattenFromString(cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME)),
- cursor.getString(PHONE_ACCOUNT_ID));
- TelephonyManager telephonyManager =
- context
- .getSystemService(TelephonyManager.class)
- .createForPhoneAccountHandle(phoneAccount);
+ TelephonyManager telephonyManager = null;
+ ComponentName componentName = ComponentName.unflattenFromString(
+ cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME));
+ if (componentName != null) {
+ phoneAccount =
+ new PhoneAccountHandle(componentName, cursor.getString(PHONE_ACCOUNT_ID));
+ telephonyManager = context.getSystemService(TelephonyManager.class)
+ .createForPhoneAccountHandle(phoneAccount);
+ }
if (telephonyManager == null) {
// can happen when trying to fetch voicemails from a SIM that is no longer on the
// device