summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-11-18 15:31:36 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-11-18 15:31:36 -0800
commit3ec7f823c3ec0eedaf4044bd535411e59bcc820a (patch)
tree137ef5bdef513b270a949271b453ce65bc0a95f1
parent60ab95138ea9ae5d891f40c238f5bbb0bc71f6ac (diff)
parent8b7de609514b93ae196fb893bb9cd7daf0202a10 (diff)
am 8b7de609: am 1ae0cf68: Fix possible NPE in DialerDatabaseHelper
* commit '8b7de609514b93ae196fb893bb9cd7daf0202a10': Fix possible NPE in DialerDatabaseHelper
-rw-r--r--src/com/android/dialer/database/DialerDatabaseHelper.java9
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));