diff options
author | Yorke Lee <yorkelee@google.com> | 2013-11-18 15:34:06 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-18 15:34:06 -0800 |
commit | f3b71b7d92bd9179dd35fff423063ae9abdcffae (patch) | |
tree | bc6bbb2a5e74315045aa8e1f6f25ba92d0c93397 | |
parent | d4ee78b8d6c223ce536822e5697218fee8e33d1c (diff) | |
parent | 3ec7f823c3ec0eedaf4044bd535411e59bcc820a (diff) |
am 3ec7f823: am 8b7de609: am 1ae0cf68: Fix possible NPE in DialerDatabaseHelper
* commit '3ec7f823c3ec0eedaf4044bd535411e59bcc820a':
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)); |