diff options
author | Raj Yengisetty <rajesh@cyngn.com> | 2015-03-10 10:08:23 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-03-22 15:03:04 -0700 |
commit | c8fd37f6ecbd78177f84eee1493526ff8b6e480c (patch) | |
tree | 0ea68572aebf0b7b9ec582373cf7c0e5c10dfa75 /src | |
parent | 204848fa248948c60757fe7823c73980cc85cf9a (diff) | |
download | android_packages_apps_ContactsCommon-c8fd37f6ecbd78177f84eee1493526ff8b6e480c.tar.gz android_packages_apps_ContactsCommon-c8fd37f6ecbd78177f84eee1493526ff8b6e480c.tar.bz2 android_packages_apps_ContactsCommon-c8fd37f6ecbd78177f84eee1493526ff8b6e480c.zip |
ContactsCommon: fix FC when deleting SIM contacts after SIM is removed
Repro:
- Create local contact
- Export to SIM
- Remove SIM
- Go to delete menu option
- Select all (*include* exported SIM contact)
- Click check mark
- Observe Contacts app force closes when deleting the exported contact
Change-Id: I2bfecf8b19c8f1eae9559a4e6f46ff477da4dc74
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/contacts/common/SimContactsOperation.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/contacts/common/SimContactsOperation.java b/src/com/android/contacts/common/SimContactsOperation.java index ef34fccd..60fc9f12 100644 --- a/src/com/android/contacts/common/SimContactsOperation.java +++ b/src/com/android/contacts/common/SimContactsOperation.java @@ -92,6 +92,9 @@ public class SimContactsOperation { public Uri insert(ContentValues values, int subscription) { Uri uri = getContentUri(subscription); + if (uri == null) { + return null; + } String number = values.getAsString(SimContactsConstants.STR_NUMBER); String anrs = values.getAsString(SimContactsConstants.STR_ANRS); String emails = values.getAsString(SimContactsConstants.STR_EMAILS); @@ -106,7 +109,9 @@ public class SimContactsOperation { public int update(ContentValues values,int subscription) { Uri uri = getContentUri(subscription); - + if (uri == null) { + return -1; + } int result; String oldNumber = values.getAsString(SimContactsConstants.STR_NUMBER); String newNumber = values.getAsString(SimContactsConstants.STR_NEW_NUMBER); @@ -136,6 +141,10 @@ public class SimContactsOperation { anrs = PhoneNumberUtils.stripSeparators(anrs); Uri uri = getContentUri(subscription); + if (uri == null) { + return -1; + } + if (!TextUtils.isEmpty(name)) { buf.append("tag='"); @@ -168,6 +177,9 @@ public class SimContactsOperation { int[] subId = SubscriptionManager.getSubId(subscription); if (subId != null && TelephonyManager.getDefault().isMultiSimEnabled()) { + if (subId.length < 1 || subId[0] < 0) { + return null; + } uri = Uri.parse(SimContactsConstants.SIM_SUB_URI + subId[0]); } else { uri = Uri.parse(SimContactsConstants.SIM_URI); |