summaryrefslogtreecommitdiff
path: root/java/com/android/voicemail/impl/fetch
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/voicemail/impl/fetch')
-rw-r--r--java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java b/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
index b0285672e..0348a60c5 100644
--- a/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
+++ b/java/com/android/voicemail/impl/fetch/FetchVoicemailReceiver.java
@@ -120,6 +120,16 @@ public class FetchVoicemailReceiver extends BroadcastReceiver {
new PhoneAccountHandle(
ComponentName.unflattenFromString(cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME)),
cursor.getString(PHONE_ACCOUNT_ID));
+ TelephonyManager telephonyManager =
+ context
+ .getSystemService(TelephonyManager.class)
+ .createForPhoneAccountHandle(mPhoneAccount);
+ if (telephonyManager == null) {
+ // can happen when trying to fetch voicemails from a SIM that is no longer on the
+ // device
+ VvmLog.e(TAG, "account no longer valid, cannot retrieve message");
+ return;
+ }
if (!VvmAccountManager.isAccountActivated(context, mPhoneAccount)) {
mPhoneAccount = getAccountFromMarshmallowAccount(context, mPhoneAccount);
if (mPhoneAccount == null) {