Fix NPE in ViewPagerStrips
Bug: 22201498
Change-Id: I4c44b91d5d19a17958fd8fd6b9433875a30a9901
diff --git a/src/com/android/contacts/common/list/ViewPagerTabStrip.java b/src/com/android/contacts/common/list/ViewPagerTabStrip.java
index 964db5f..c8ae21a 100644
--- a/src/com/android/contacts/common/list/ViewPagerTabStrip.java
+++ b/src/com/android/contacts/common/list/ViewPagerTabStrip.java
@@ -72,6 +72,13 @@
// Thick colored underline below the current selection
if (childCount > 0) {
View selectedTitle = getChildAt(mIndexForSelection);
+
+ if (selectedTitle == null) {
+ // The view pager's tab count changed but we weren't notified yet. Ignore this draw
+ // pass, when we get a new selection we will update and draw the selection strip in
+ // the correct place.
+ return;
+ }
int selectedLeft = selectedTitle.getLeft();
int selectedRight = selectedTitle.getRight();
final boolean isRtl = isRtl();