summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2016-04-28 09:36:13 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-05-06 14:05:58 -0700
commit0584da89a8c1c2e5f2e640c57b91e88160084d6c (patch)
tree834c2c2fe340f4b051574cbb645eaea27a5aff39
parent609aa137f7436ba033f7d077c1328bb4d26f447b (diff)
downloadpackages_providers_ContactsProvider-0584da89a8c1c2e5f2e640c57b91e88160084d6c.zip
packages_providers_ContactsProvider-0584da89a8c1c2e5f2e640c57b91e88160084d6c.tar.gz
packages_providers_ContactsProvider-0584da89a8c1c2e5f2e640c57b91e88160084d6c.tar.bz2
ContactsProvider: don't crash on locale change
Catch crashes when looking up nonexistant resources stored in the group title_res table. Ticket: CYNGNOS-2656, OSS NIGHTLIES-2952 Change-Id: Id496df461f16dcf7a7596347dda5e3ff806767d0 Signed-off-by: Roman Birg <roman@cyngn.com>
-rw-r--r--src/com/android/providers/contacts/ContactsDatabaseHelper.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/providers/contacts/ContactsDatabaseHelper.java b/src/com/android/providers/contacts/ContactsDatabaseHelper.java
index 8935149..3e37103 100644
--- a/src/com/android/providers/contacts/ContactsDatabaseHelper.java
+++ b/src/com/android/providers/contacts/ContactsDatabaseHelper.java
@@ -3530,9 +3530,14 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper {
groupId = cursor.getLong(0);
titleRes = cursor.getInt(1);
values.clear();
- values.put(Groups.TITLE, mContext.getResources().getString(titleRes));
- db.update(Tables.GROUPS, values, Groups._ID + " = ?", new String[] {
- String.valueOf(groupId)});
+ try {
+ final String lookup = mContext.getResources().getString(titleRes);
+ values.put(Groups.TITLE, lookup);
+ db.update(Tables.GROUPS, values, Groups._ID + " = ?", new String[]{
+ String.valueOf(groupId)});
+ } catch (Resources.NotFoundException e) {
+ Log.e(TAG, "could not find resource " + titleRes + " for groupId " + groupId);
+ }
}
} finally {
cursor.close();