diff options
author | Yorke Lee <yorkelee@google.com> | 2013-11-18 15:28:26 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-18 15:28:26 -0800 |
commit | 8b7de609514b93ae196fb893bb9cd7daf0202a10 (patch) | |
tree | ebf3143a3d842c584b9df1d99bcb826c35123545 | |
parent | 8aee66a64c2a78747245b91dbc979a8ce8239f2b (diff) | |
parent | 1ae0cf68723dfaf05f387f2759b4f59e6271ba6c (diff) |
am 1ae0cf68: Fix possible NPE in DialerDatabaseHelper
* commit '1ae0cf68723dfaf05f387f2759b4f59e6271ba6c':
Fix possible NPE in DialerDatabaseHelper
-rw-r--r-- | src/com/android/dialer/database/DialerDatabaseHelper.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/dialer/database/DialerDatabaseHelper.java b/src/com/android/dialer/database/DialerDatabaseHelper.java index e9d773561..b9e4b9a90 100644 --- a/src/com/android/dialer/database/DialerDatabaseHelper.java +++ b/src/com/android/dialer/database/DialerDatabaseHelper.java @@ -37,6 +37,7 @@ import android.text.TextUtils; import android.util.Log; import com.android.contacts.common.util.StopWatch; +import com.android.dialer.R; import com.android.dialer.dialpad.SmartDialNameMatcher; import com.android.dialer.dialpad.SmartDialPrefix; @@ -631,7 +632,13 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { insert.bindString(2, updatedContactCursor.getString(PhoneQuery.PHONE_NUMBER)); insert.bindLong(3, updatedContactCursor.getLong(PhoneQuery.PHONE_CONTACT_ID)); insert.bindString(4, updatedContactCursor.getString(PhoneQuery.PHONE_LOOKUP_KEY)); - insert.bindString(5, updatedContactCursor.getString(PhoneQuery.PHONE_DISPLAY_NAME)); + final String displayName = updatedContactCursor.getString( + PhoneQuery.PHONE_DISPLAY_NAME); + if (displayName == null) { + insert.bindString(5, mContext.getResources().getString(R.string.missing_name)); + } else { + insert.bindString(5, displayName); + } insert.bindLong(6, updatedContactCursor.getLong(PhoneQuery.PHONE_PHOTO_ID)); insert.bindLong(7, updatedContactCursor.getLong(PhoneQuery.PHONE_LAST_TIME_USED)); insert.bindLong(8, updatedContactCursor.getInt(PhoneQuery.PHONE_TIMES_USED)); |