summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/contacts/common/util/TelephonyManagerUtils.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/contacts/common/util/TelephonyManagerUtils.java b/src/com/android/contacts/common/util/TelephonyManagerUtils.java
index 5f9b062d..ad7100b8 100644
--- a/src/com/android/contacts/common/util/TelephonyManagerUtils.java
+++ b/src/com/android/contacts/common/util/TelephonyManagerUtils.java
@@ -123,13 +123,18 @@ public class TelephonyManagerUtils {
}
long subId[] = SubscriptionManager.getSubId(subscription);
+ String subIdstr = null;
+ if (subId != null && subId.length > 0) {
+ subIdstr = String.valueOf(subId[0]);
+ } else {
+ return null;
+ }
final TelecomManager telecomManager = (TelecomManager) context
.getSystemService(Context.TELECOM_SERVICE);
List<PhoneAccountHandle> pHandles = telecomManager.getCallCapablePhoneAccounts();
PhoneAccountHandle phoneAccountHandle = null;
for (PhoneAccountHandle itorator : pHandles) {
- if (subId != null
- && String.valueOf(subId[0]).equals(itorator.getId())) {
+ if (subIdstr != null && subIdstr.equals(itorator.getId())) {
phoneAccountHandle = itorator;
}
}