diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientLoader.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientLoader.java index 5c01427a7..e7ea7cfaa 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientLoader.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientLoader.java @@ -240,7 +240,8 @@ public class RecipientLoader extends AsyncTaskLoader> { Cursor cursor = contentResolver .query(queryUri, PROJECTION, selection, new String[] { id }, SORT_ORDER); - fillContactDataFromCursor(cursor, recipients, recipientMap, nicknameCursor.getString(INDEX_NICKNAME)); + String contactNickname = nicknameCursor.getString(INDEX_NICKNAME); + fillContactDataFromCursor(cursor, recipients, recipientMap, contactNickname); hasContact = true; } @@ -281,12 +282,11 @@ public class RecipientLoader extends AsyncTaskLoader> { } private void fillContactDataFromCursor(Cursor cursor, List recipients, - Map recipientMap, @Nullable String name) { + Map recipientMap, @Nullable String prefilledName) { while (cursor.moveToNext()) { - if (name == null) { - name = cursor.getString(INDEX_NAME); - } + String name = prefilledName != null ? prefilledName : cursor.getString(INDEX_NAME); + String email = cursor.getString(INDEX_EMAIL); long contactId = cursor.getLong(INDEX_CONTACT_ID); String lookupKey = cursor.getString(INDEX_LOOKUP_KEY);