Fixing possible crash on tab switch.

Bug: 16873267
Change-Id: I66309fad4b2e49dd5ca8ba0d17a88a6a0ede07a9
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java
index 966d265..22cb35c 100644
--- a/src/com/android/dialer/list/ListsFragment.java
+++ b/src/com/android/dialer/list/ListsFragment.java
@@ -331,11 +331,11 @@
 
     @Override
     public void onPageSelected(int position) {
-        if (position == TAB_INDEX_SPEED_DIAL) {
+        if (position == TAB_INDEX_SPEED_DIAL && mSpeedDialFragment != null) {
             mSpeedDialFragment.sendScreenView();
-        } else if (position == TAB_INDEX_RECENTS) {
+        } else if (position == TAB_INDEX_RECENTS && mRecentsFragment != null) {
             mRecentsFragment.sendScreenView();
-        } else if (position == TAB_INDEX_ALL_CONTACTS) {
+        } else if (position == TAB_INDEX_ALL_CONTACTS && mAllContactsFragment != null) {
             mAllContactsFragment.sendScreenView();
         }
         final int count = mOnPageChangeListeners.size();