resolved conflicts for merge of c4d46df7 to jb-mr2-dev

Change-Id: I8d4c64832f989c70ef432730ab584e3dc71ad004
diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java
index 8fe6dbf..8b8b2d3 100644
--- a/chips/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java
@@ -2281,7 +2281,7 @@
         }
     }
 
-    public boolean lastCharacterIsCommitCharacter(CharSequence s) {
+   public boolean lastCharacterIsCommitCharacter(CharSequence s) {
         char last;
         int end = getSelectionEnd() == 0 ? 0 : getSelectionEnd() - 1;
         int len = length() - 1;
@@ -2488,8 +2488,8 @@
                                     new ArrayList<RecipientChip>();
                             for (final RecipientChip temp : recipients) {
                                 RecipientEntry entry = null;
-                                if (RecipientEntry.isCreatedRecipient(temp.getEntry()
-                                        .getContactId())
+                                if (temp != null && RecipientEntry.isCreatedRecipient(
+                                        temp.getEntry().getContactId())
                                         && getSpannable().getSpanStart(temp) != -1) {
                                     // Replace this.
                                     entry = createValidatedEntry(