Fixing NPE in "pick or create new contact"
Bug: 2513826
Change-Id: I258da57feef78e3f30ee8372dba6caed81adc76d
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index 28c5502..06a24e5 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -3481,7 +3481,11 @@
} else if (isSearchAllContactsItemPosition(pos)){
return null;
} else {
- return super.getItem(getRealPosition(pos));
+ int realPosition = getRealPosition(pos);
+ if (realPosition < 0) {
+ return null;
+ }
+ return super.getItem(realPosition);
}
}
@@ -3496,7 +3500,11 @@
} else if (isSearchAllContactsItemPosition(pos)) {
return 0;
}
- return super.getItemId(getRealPosition(pos));
+ int realPosition = getRealPosition(pos);
+ if (realPosition < 0) {
+ return 0;
+ }
+ return super.getItemId(realPosition);
}
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,